diff --git a/best_annotator/static/assets/MeatEditor-0DhnHy7F.js b/best_annotator/static/assets/MeatEditor-0DhnHy7F.js new file mode 100644 index 0000000000000000000000000000000000000000..d83b72e8733a6006a3a786e1f07b6a2329991725 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-0DhnHy7F.js @@ -0,0 +1,14 @@ +import{j as r,r as u,M as be}from"./index-FHNXxhzy.js";import{aA as ye,h as me,am as we,t as Me,u as q,ae as je,D as Ce,m as ue,aw as Ee,a0 as Se,a3 as ke,ay as Ae,aE as oe}from"./OrbitControls-B8kTSyNG.js";const Pe=["left","right","top","bottom","front","back"];function he(t,s){const[o,d,a]=t.size,c=t.inflate,f=new ye(o+c,d+c,a+c,o,d,a),m=f.toNonIndexed();f.dispose();const i=m.getAttribute("position"),l=m.getAttribute("uv"),h=[],p=[],g=[],x=[],k=[],b=new me;for(const E of m.groups){const[R,N,X,C,W,Y]=t.faces[Pe[E.materialIndex]];for(let S=E.start;S{d.array[m]=s[f]?1:0}),d.needsUpdate=!0;const a=t.getAttribute("meatColor"),c=new me;t.userData.vertexIds.forEach((f,m)=>{c.set(o?.[s[f]]||"#19ff9d"),a.setXYZ(m,c.r,c.g,c.b)}),a.needsUpdate=!0}function Ue(t,s){const o=Array.from({length:4096},()=>new Set);for(const d of t){const a=he(d,s),c=new Map,f=a.getAttribute("position"),m=a.userData.triangleIds,i=l=>[f.getX(l),f.getY(l),f.getZ(l)].map(h=>Math.round(h*1e4)).join(",");for(let l=0;lArray.from(d))}function Ie(t){const s=new je({vertexColors:!0,side:Ce});return s.onBeforeCompile=o=>{o.uniforms.meatPulse=t,o.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.vertexShader,o.vertexShader=o.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),o.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.fragmentShader,o.fragmentShader=o.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},s.customProgramCacheKey=()=>"meat-pulse-grid-v3",s}function _e(t,s,o,d,a,c){if(!o[t]||!d[t])return[];const f=Math.max(0,Math.min(100,Number(c)||0)),m=new Uint8Array(4096),i=[t],l=[];for(m[t]=1;i.length;){const h=i.pop();if(!o[h]||!d[h])continue;let p=0;for(let g=0;g<3;g++)p+=(s[h*4+g]-s[t*4+g])**2;if(!(Math.sqrt(p/3)/255*100>f+1e-9)){l.push(h);for(const g of a[h])m[g]||(m[g]=1,i.push(g))}}return l}function De(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function de(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function Re(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}function Te(t,s){return Uint8Array.from(t,o=>o===s?o:0)}function Ve(t,s,o,d){const a=t.slice();for(const c of s)(d!==0||a[c]===o)&&(a[c]=d);return a}function Le(t,s,o){const d=t.slice(),a=new Set(s);for(let c=0;c<4096;c++)o[c]?(d[c]===0||d[c]===1)&&(d[c]=a.has(c)?1:0):d[c]=0;return d}function Oe(t,s,o){if(!s.semantic_available)return Le(t,s.selected,o);const d=s.class_ids||[1,2,3,5,6],a=new Set([1,2,3,5,6,9,10]);if(d.some(i=>!a.has(i)))throw Error("模型类别不兼容");const c=new Set([0,...d]);if(!Array.isArray(s.labels)||s.labels.length!==4096||s.labels.some(i=>!Number.isInteger(i)||!c.has(i)))throw Error("模型细分类格式无效,未应用预选");const f=Uint8Array.from(s.labels,(i,l)=>o[l]?i:0),m=new Set(s.selected);if(f.some((i,l)=>!!(o[l]&&m.has(l))!==[1,2,3,9,10].includes(i)))throw Error("模型细分类与 meat 选区不一致,未应用预选");for(let i=0;i<4096;i++)o[i]&&t[i]>0&&!c.has(t[i])&&(f[i]=t[i]);return f}const H=[0,-2,0];function Ye(t,s,o){const a={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[s];t.up.set(...s==="top"?[0,0,-1]:s==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...a.map((c,f)=>c+H[f])),t.lookAt(...H),o&&(o.target.set(...H),o.update()),t.updateMatrixWorld()}const fe=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0));function Be({part:t,rgba:s,mask:o,palette:d,pulse:a,pickDown:c,pickUp:f,hover:m}){const i=u.useMemo(()=>he(t,s),[t,s]),l=u.useMemo(()=>Ie(a),[a]);u.useEffect(()=>{Ne(i,o,d)},[i,o,d]),u.useEffect(()=>()=>{i.dispose(),l.dispose()},[i,l]);const h=(p,g)=>{p.stopPropagation();const x=i.userData.triangleIds[p.faceIndex];x!==void 0&&(m(x),g==="down"&&c(x),g==="up"&&f())};return r.jsx("mesh",{geometry:i,material:l,position:t.center,onPointerDown:p=>h(p,"down"),onPointerMove:p=>h(p,"hover"),onPointerUp:p=>h(p,"up")})}function Xe({data:t,rgba:s,mask:o,palette:d,layer:a,animate:c,view:f,viewEpoch:m,pickDown:i,pickUp:l,hover:h}){const p=u.useMemo(()=>({value:.85}),[]),g=u.useRef(),{camera:x,size:k}=Se();return ke(({clock:b})=>{p.value=c?.68+.28*Math.sin(b.elapsedTime*Math.PI):.85}),u.useEffect(()=>{Ye(x,f,g.current)},[f,m,x]),u.useEffect(()=>{x.zoom=Math.min(k.width/36,k.height/42),x.updateProjectionMatrix()},[x,k.width,k.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(b=>a==="both"||b.layer===(a==="inner"?0:1)).map(b=>r.jsx(Be,{part:b,rgba:s,mask:o,palette:d,pulse:p,pickDown:i,pickUp:l,hover:h},b.name+b.layer)),r.jsx(Ae,{ref:g,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:oe.ROTATE,MIDDLE:oe.DOLLY,RIGHT:oe.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:s,onSave:o,onDirty:d}){const[a,c]=u.useState(1),f=t.semantic?.classes||[],m=u.useMemo(()=>Object.fromEntries(f.map(e=>[e.id,e.color])),[t.semantic]),i=f.find(e=>e.id===a)?.label||"裸露皮肤",[l,h]=u.useState(!1),[p,g]=u.useState(null),[x,k]=u.useState(!1),b=s||l,j=u.useMemo(()=>fe(t.rgba),[t.rgba]),E=u.useMemo(()=>fe(t.valid),[t.valid]),R=u.useMemo(()=>Uint8Array.from(t.labels),[t]),[N,X]=u.useState(R),C=u.useRef(R),W=u.useMemo(()=>Te(N,a),[N,a]),[Y,S]=u.useState("toggle"),[_,F]=u.useState("both"),[G,Z]=u.useState("front"),[U,A]=u.useState(12),[J,Q]=u.useState(0),pe=u.useMemo(()=>Ue(t.parts,j),[t.parts,j]),[$,ge]=u.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[T,ae]=u.useState(null),[V,ee]=u.useState({entries:[R],index:0}),L=u.useRef(null),ie=u.useRef(null),te=u.useRef(N),I=u.useRef(null),ne=u.useMemo(()=>({selected:N.reduce((e,n)=>e+(n>0?1:0),0),active:N.reduce((e,n)=>e+(n===a?1:0),0),valid:E.reduce((e,n)=>e+n,0)}),[N,E,a]),K=x||N.some((e,n)=>e!==R[n]),z=u.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{_!=="both"&&n.layer!==(_==="inner"?0:1)||Object.values(n.faces).forEach(([y,w,P,D])=>{for(let O=w;O{C.current=e,te.current=e,X(e),k(!1)},M=()=>{L.current&&(C.current.some((e,n)=>e!==L.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),C.current].slice(-60);return{entries:n,index:n.length-1}}),L.current=null)},le=(e,n=!1,y=!1)=>{if(b||!E[e]||!z[e]||(n&&(M(),L.current={before:C.current,value:Y==="erase"||C.current[e]===a?0:a,flood:y}),!L.current)||!n&&L.current.flood)return;const w=L.current.value,P=y&&n?_e(e,j,E,z,pe,U):[e];P.every(D=>C.current[D]===w)||re(Ve(C.current,P,a,w))},ve=e=>{I.current&&(I.current.id=e)},xe=()=>{const e=I.current;Re(e)&&(le(e.id,!0,e.ctrl),M()),e&&(e.cancelled=!0)};u.useEffect(()=>{d(K)},[K,d]),u.useEffect(()=>(window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),window.addEventListener("blur",M),()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),window.removeEventListener("blur",M)}),[]),u.useEffect(()=>{const e=n=>{K&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[K]);const se=e=>{if(b)return;M();const n=V.index+e;n<0||n>=V.entries.length||(re(V.entries[n]),ee({...V,index:n}))};u.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),se(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),u.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),y=document.createElement("canvas");y.width=64,y.height=64,y.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(j),64,64),0,0);let w,P=0;const D=O=>{if(O-P>40){P=O,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(y,0,0,512,512);const B=$?.68+.28*Math.sin(O/1e3*Math.PI):.85;for(let v=0;v<4096;v++)(!E[v]||!z[v])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(v%64*8,Math.floor(v/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let v=0;v<=64;v++)n.moveTo(v*8,0),n.lineTo(v*8,512),n.moveTo(0,v*8),n.lineTo(512,v*8);n.stroke();for(let v=0;v<4096;v++)E[v]&&z[v]&&te.current[v]===a&&(n.strokeStyle="#03140d",n.globalAlpha=B*.65,n.lineWidth=1.8,n.strokeRect(v%64*8+.5,Math.floor(v/64)*8+.5,7,7),n.strokeStyle=m?.[te.current[v]]||"#19ff9d",n.globalAlpha=B,n.lineWidth=1,n.strokeRect(v%64*8+.5,Math.floor(v/64)*8+.5,7,7),n.globalAlpha=1);T!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(T%64*8+1,Math.floor(T/64)*8+1,6,6))}w=requestAnimationFrame(D)};return w=requestAnimationFrame(D),()=>cancelAnimationFrame(w)},[j,E,z,$,T,m,a]);const ce=(e,n)=>{const y=e.currentTarget.getBoundingClientRect(),w=Math.floor((e.clientX-y.left)/y.width*64),P=Math.floor((e.clientY-y.top)/y.height*64);if(w<0||w>=64||P<0||P>=64)return;const D=P*64+w;ae(D),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),le(D,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"每格只能属于一个类别,直接涂选即可替换原类别。旧 meat 标注默认归为裸露皮肤,已有细分类保留。未选格为非 meat;裸露皮肤、眼睛、嘴巴、眼影和鼻子会自动汇总为 meat,眉毛和胡子仍属非 meat。"}),r.jsx("p",{className:"meat-help",children:"眼影仅指眼周明确的妆容色块,不含眼线、睫毛、眉毛或普通光照阴影。鼻子只标能辨认的鼻部,不把整块脸中央都算作鼻子;未画出或被遮住时可不标。"}),r.jsxs("p",{className:"meat-definition",children:["当前只高亮“",i,"”。完全被外层遮住的内层格已按正对正交投影排除(",t.occluded_count||0," 格)。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(be,{data:t,disabled:b,hint:"当前模型预选原五类;已有眼影、鼻子会保留。可撤销,保存后才写入。",onStart:()=>{M(),h(!0)},onEnd:()=>h(!1),onApply:e=>{const n=Oe(C.current,e,E);re(n),ee(y=>{const w=[...y.entries.slice(0,y.index+1),n].slice(-60);return{entries:w,index:w.length-1}}),g({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),t.semantic.assistant_known_count>0&&r.jsxs("p",{className:"meat-warning",children:["其中 ",t.semantic.assistant_known_count," 格来自助手补标,尚未人工复核。修改格子会记录人工来源;切换类别仅改变高亮显示。"]}),r.jsxs("label",{className:"meat-help",children:[r.jsx("input",{type:"checkbox",checked:x,disabled:b,onChange:e=>k(e.target.checked)}),"本次已完整复核七类(含未选区域)"]}),r.jsx("p",{className:"meat-help",children:"勾选后保存,表示所有有效格已检查:未选格明确不属于这七类,可帮助模型识别衣饰和头发。还没检查完时保持不勾选,未细标格继续只参与 meat 二分类训练。"}),t.semantic.status==="needs_review"&&r.jsx("p",{className:"meat-warning",children:"旧分类与当前 meat 有冲突的格子已回退到当前二分类,请直接重新指定类别。"}),r.jsxs("label",{className:"semantic-category",children:["标注类别 ",r.jsx("select",{"aria-label":"标注类别",value:a,onChange:e=>{M(),c(Number(e.target.value))},children:f.map(e=>r.jsx("option",{value:e.id,children:e.label},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:f.map(e=>r.jsxs("button",{"aria-pressed":a===e.id,className:a===e.id?"active":"",style:{borderColor:e.color},onClick:()=>{M(),c(e.id)},children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:Y==="toggle"?"active":"",onClick:()=>S("toggle"),children:"点击切换选中"}),r.jsx("button",{className:Y==="erase"?"active":"",onClick:()=>S("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>A(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:_,onChange:e=>F(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:b||V.index===0,onClick:()=>se(-1),children:"撤销"}),r.jsx("button",{disabled:b||V.index===V.entries.length-1,onClick:()=>se(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:$,onChange:e=>ge(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:G===e?"active":"",onClick:()=>{Z(e),Q(y=>y+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=De(e)},onPointerMoveCapture:e=>de(I.current,e),onPointerUpCapture:e=>de(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(Ee,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Xe,{data:t,rgba:j,mask:W,palette:m,layer:_,animate:$,view:G,viewEpoch:J,pickDown:ve,pickUp:xe,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:T===null?"透明区域不参与标注":`UV (${T%64}, ${Math.floor(T/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ce(e,!0),onPointerMove:e=>ce(e,!1),onPointerUp:M})]})]}),r.jsx("p",{className:"meat-help",children:"3D 和 UV 只用呼吸边框高亮当前类别,保留皮肤原色。点击其他类别的格子会改为当前类别;再次点击当前类别取消选择。Ctrl+点击泛洪选择近似颜色,阈值可调。擦除只影响当前类别,不会删除未高亮的其他类别。拖拽旋转不会标注,UV 可连续涂选。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:[i,":",ne.active," 格 · 共已分类 ",ne.selected," / ",ne.valid," 格",K?" · 未保存":"",r.jsxs("small",{children:["保存分类时同时更新 ",t.id,"_semantic.png 和兼容的 ",t.id,"_meat.png。"]})]}),r.jsx("button",{className:"button secondary",disabled:b,onClick:()=>{M(),o(Array.from(C.current),!1,p,x)},children:"保存分类"}),r.jsx("button",{className:"button",disabled:b,onClick:()=>{M(),o(Array.from(C.current),!0,p,x)},children:"保存并标注下一张"})]})]})}function ze({data:t,busy:s,onSave:o,onDirty:d}){return r.jsx(Fe,{data:t,busy:s,onSave:o,onDirty:d},`${t.key}-${t.meat_revision}-${t.semantic.semantic_revision}`)}export{ze as default}; diff --git a/best_annotator/static/assets/MeatEditor-BZS2SjzS.js b/best_annotator/static/assets/MeatEditor-BZS2SjzS.js new file mode 100644 index 0000000000000000000000000000000000000000..240bc4132895b919185ab12bbefb13ed3921ab78 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-BZS2SjzS.js @@ -0,0 +1,14 @@ +import{r as s,R as ye,j as r,M as Me}from"./index-1xYycQFu.js";import{aA as je,h as he,am as we,t as Ce,u as q,ae as Ee,D as Se,m as de,aw as ke,a0 as Ae,a3 as Pe,ay as Ne,aE as se}from"./OrbitControls-DQYijb2B.js";const Ue=["left","right","top","bottom","front","back"];function ge(t,o){const[l,v,i]=t.size,c=t.inflate,m=new je(l+c,v+c,i+c,l,v,i),f=m.toNonIndexed();m.dispose();const h=f.getAttribute("position"),a=f.getAttribute("uv"),d=[],g=[],p=[],b=[],S=[],w=new he;for(const A of f.groups){const[N,L,T,B,j,X]=t.faces[Ue[A.materialIndex]];for(let C=A.start;C{v.array[f]=o[m]?1:0}),v.needsUpdate=!0;const i=t.getAttribute("meatColor"),c=new he;t.userData.vertexIds.forEach((m,f)=>{c.set(l?.[o[m]]||"#19ff9d"),i.setXYZ(f,c.r,c.g,c.b)}),i.needsUpdate=!0}function Re(t,o){const l=Array.from({length:4096},()=>new Set);for(const v of t){const i=ge(v,o),c=new Map,m=i.getAttribute("position"),f=i.userData.triangleIds,h=a=>[m.getX(a),m.getY(a),m.getZ(a)].map(d=>Math.round(d*1e4)).join(",");for(let a=0;aArray.from(v))}function De(t){const o=new Ee({vertexColors:!0,side:Se});return o.onBeforeCompile=l=>{l.uniforms.meatPulse=t,l.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.vertexShader,l.vertexShader=l.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),l.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.fragmentShader,l.fragmentShader=l.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},o.customProgramCacheKey=()=>"meat-pulse-grid-v3",o}function Te(t,o,l,v,i,c){if(!l[t]||!v[t])return[];const m=Math.max(0,Math.min(100,Number(c)||0)),f=new Uint8Array(4096),h=[t],a=[];for(f[t]=1;h.length;){const d=h.pop();if(!l[d]||!v[d])continue;let g=0;for(let p=0;p<3;p++)g+=(o[d*4+p]-o[t*4+p])**2;if(!(Math.sqrt(g/3)/255*100>m+1e-9)){a.push(d);for(const p of i[d])f[p]||(f[p]=1,h.push(p))}}return a}function Ve(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function fe(t,o){t&&t.pointerId===o.pointerId&&Math.hypot(o.clientX-t.x,o.clientY-t.y)>5&&(t.dragged=!0)}function _e(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const H=[0,-2,0];function Le(t,o,l){const i={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[o];t.up.set(...o==="top"?[0,0,-1]:o==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...i.map((c,m)=>c+H[m])),t.lookAt(...H),l&&(l.target.set(...H),l.update()),t.updateMatrixWorld()}const me=t=>Uint8Array.from(atob(t),o=>o.charCodeAt(0)),oe=t=>{const o=new Uint8Array(4096);return t.forEach(l=>o[l]=1),o};function Oe({part:t,rgba:o,mask:l,palette:v,pulse:i,pickDown:c,pickUp:m,hover:f}){const h=s.useMemo(()=>ge(t,o),[t,o]),a=s.useMemo(()=>De(i),[i]);s.useEffect(()=>{Ie(h,l,v)},[h,l,v]),s.useEffect(()=>()=>{h.dispose(),a.dispose()},[h,a]);const d=(g,p)=>{g.stopPropagation();const b=h.userData.triangleIds[g.faceIndex];b!==void 0&&(f(b),p==="down"&&c(b),p==="up"&&m())};return r.jsx("mesh",{geometry:h,material:a,position:t.center,onPointerDown:g=>d(g,"down"),onPointerMove:g=>d(g,"hover"),onPointerUp:g=>d(g,"up")})}function Ye({data:t,rgba:o,mask:l,palette:v,layer:i,animate:c,view:m,viewEpoch:f,pickDown:h,pickUp:a,hover:d}){const g=s.useMemo(()=>({value:.85}),[]),p=s.useRef(),{camera:b,size:S}=Ae();return Pe(({clock:w})=>{g.value=c?.68+.28*Math.sin(w.elapsedTime*Math.PI):.85}),s.useEffect(()=>{Le(b,m,p.current)},[m,f,b]),s.useEffect(()=>{b.zoom=Math.min(S.width/36,S.height/42),b.updateProjectionMatrix()},[b,S.width,S.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(w=>i==="both"||w.layer===(i==="inner"?0:1)).map(w=>r.jsx(Oe,{part:w,rgba:o,mask:l,palette:v,pulse:g,pickDown:h,pickUp:a,hover:d},w.name+w.layer)),r.jsx(Ne,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:se.ROTATE,MIDDLE:se.DOLLY,RIGHT:se.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:o,onSave:l,onDirty:v,semantic:i=!1}){const[c,m]=s.useState(2),[f,h]=s.useState(""),a=t.semantic?.classes||[],d=s.useMemo(()=>i?Object.fromEntries(a.map(e=>[e.id,e.color])):void 0,[i,t.semantic]),g=s.useMemo(()=>oe(t.selected),[t.selected]),[p,b]=s.useState(!1),[S,w]=s.useState(null),M=o||p||i&&!t.semantic?.available,A=s.useMemo(()=>me(t.rgba),[t.rgba]),N=s.useMemo(()=>me(t.valid),[t.valid]),L=s.useMemo(()=>i?Uint8Array.from(t.semantic.labels):oe(t.selected),[t,i]),[T,B]=s.useState(L),j=s.useRef(L),[X,C]=s.useState("toggle"),[V,G]=s.useState("both"),[K,W]=s.useState("front"),[U,P]=s.useState(12),[J,Q]=s.useState(0),pe=s.useMemo(()=>Re(t.parts,A),[t.parts,A]),[Z,ve]=s.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[O,ae]=s.useState(null),[Y,ee]=s.useState({entries:[L],index:0}),F=s.useRef(null),ie=s.useRef(null),te=s.useRef(T),I=s.useRef(null),le=s.useMemo(()=>({selected:T.reduce((e,n)=>e+(n>0?1:0),0),valid:N.reduce((e,n)=>e+n,0)}),[T,N]),z=T.some((e,n)=>e!==L[n]),$=s.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{V!=="both"&&n.layer!==(V==="inner"?0:1)||Object.values(n.faces).forEach(([x,y,k,R])=>{for(let D=y;D{j.current=e,te.current=e,B(e)},E=()=>{F.current&&(j.current.some((e,n)=>e!==F.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),F.current=null)},ce=(e,n=!1,x=!1)=>{if(M||!N[e]||!$[e]||(n&&(E(),F.current={before:j.current,value:X==="erase"||j.current[e]===(i?c:1)?0:i?c:1,flood:x}),!F.current)||!n&&F.current.flood)return;const y=F.current.value,k=x&&n?Te(e,A,N,$,pe,U):[e];if(k.every(u=>j.current[u]===y))return;const R=i&&y?a.find(u=>u.id===y).meat:null,D=k.filter(u=>R===null||!!g[u]===R);h(D.length_[u]=y),ne(_)},xe=e=>{I.current&&(I.current.id=e)},be=()=>{const e=I.current;_e(e)&&(ce(e.id,!0,e.ctrl),E()),e&&(e.cancelled=!0)};s.useEffect(()=>{v(z)},[z,v]),s.useEffect(()=>(window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",E),()=>{window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",E)}),[]),s.useEffect(()=>{const e=n=>{z&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[z]);const re=e=>{if(M)return;E();const n=Y.index+e;n<0||n>=Y.entries.length||(ne(Y.entries[n]),ee({...Y,index:n}))};s.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),re(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),s.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),x=document.createElement("canvas");x.width=64,x.height=64,x.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(A),64,64),0,0);let y,k=0;const R=D=>{if(D-k>40){k=D,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(x,0,0,512,512);const _=Z?.68+.28*Math.sin(D/1e3*Math.PI):.85;for(let u=0;u<4096;u++)(!N[u]||!$[u])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(u%64*8,Math.floor(u/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let u=0;u<=64;u++)n.moveTo(u*8,0),n.lineTo(u*8,512),n.moveTo(0,u*8),n.lineTo(512,u*8);n.stroke();for(let u=0;u<4096;u++)N[u]&&$[u]&&te.current[u]&&(n.strokeStyle="#03140d",n.globalAlpha=_*.65,n.lineWidth=1.8,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.strokeStyle=d?.[te.current[u]]||"#19ff9d",n.globalAlpha=_,n.lineWidth=1,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.globalAlpha=1);O!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(O%64*8+1,Math.floor(O/64)*8+1,6,6))}y=requestAnimationFrame(R)};return y=requestAnimationFrame(R),()=>cancelAnimationFrame(y)},[A,N,$,Z,O,d]);const ue=(e,n)=>{const x=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-x.left)/x.width*64),k=Math.floor((e.clientY-x.top)/x.height*64);if(y<0||y>=64||k<0||k>=64)return;const R=k*64+y;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),ce(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsxs("p",{className:"meat-definition",children:["meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。按各个面正对的正交投影,完全被外层遮住的内层格已透明排除(",t.occluded_count||0," 格);斜视时露出不改变此规则。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),!i&&r.jsx(Me,{data:t,disabled:M,onStart:()=>{E(),b(!0)},onEnd:()=>b(!1),onApply:e=>{const n=oe(e.selected);ne(n),ee(x=>{const y=[...x.entries.slice(0,x.index+1),n].slice(-60);return{entries:y,index:y.length-1}}),w({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),i&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"meat-definition",children:"细分类可只标容易混淆的格子,未细标格为“未知”,仍保留原 meat 标签参与二分类训练。眼睛/嘴巴属于 meat;眉毛/胡子/头发属于非 meat。"}),!t.semantic.available&&r.jsx("p",{className:"meat-warning",children:"请先保存 meat 二分类,再补细分类。"}),t.semantic.status==="needs_review"&&r.jsxs("p",{className:"meat-warning",children:["二分类曾变化,已清除 ",t.semantic.conflict_count," 个冲突的细标签;请复核并保存,其余细标签已保留。"]}),t.semantic.status==="stale"&&r.jsx("p",{className:"meat-warning",children:"原皮肤已变化,旧细分类已停用;保存时将归档旧文件。"}),r.jsxs("label",{className:"semantic-category",children:["细分类 ",r.jsx("select",{"aria-label":"细分类类别",value:c,onChange:e=>m(Number(e.target.value)),children:a.map(e=>r.jsxs("option",{value:e.id,children:[e.label," · ",e.meat?"meat":"非 meat"]},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:a.map(e=>r.jsxs("button",{className:c===e.id?"active":"",style:{borderColor:e.color},onClick:()=>m(e.id),children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))})]}),f&&r.jsx("p",{role:"status",className:"meat-warning",children:f}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:X==="toggle"?"active":"",onClick:()=>C("toggle"),children:"点击切换选中"}),r.jsx("button",{className:X==="erase"?"active":"",onClick:()=>C("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>P(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:V,onChange:e=>G(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:M||Y.index===0,onClick:()=>re(-1),children:"撤销"}),r.jsx("button",{disabled:M||Y.index===Y.entries.length-1,onClick:()=>re(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:Z,onChange:e=>ve(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:K===e?"active":"",onClick:()=>{W(e),Q(x=>x+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=Ve(e)},onPointerMoveCapture:e=>fe(I.current,e),onPointerUpCapture:e=>fe(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(ke,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Ye,{data:t,rgba:A,mask:T,palette:d,layer:V,animate:Z,view:K,viewEpoch:J,pickDown:xe,pickUp:be,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:O===null?"透明区域不参与标注":`UV (${O%64}, ${Math.floor(O/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ue(e,!0),onPointerMove:e=>ue(e,!1),onPointerUp:E})]})]}),r.jsxs("p",{className:"meat-help",children:["拖动后可点视角按钮回到正对方向,核对完全遮挡的格子。",i?"不同颜色的网格边框表示细分类;擦除仅恢复为未知,不改变 meat":"绿色网格边框表示选中的 meat",",格子内部保留皮肤原色。Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"]}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",le.selected," / ",le.valid," 格",z?" · 未保存":"",r.jsx("small",{children:i?`保存为 ${t.id}_semantic.png;未细标的格为未知,原 meat 文件保持不变。`:`保存为 ${t.id}_meat.png;未选择的有效格为非 meat。`})]}),r.jsx("button",{className:"button secondary",disabled:M,onClick:()=>{E(),l(i?Array.from(j.current):Array.from(j.current.keys()).filter(e=>j.current[e]),!1,S)},children:i?"保存细分类":"保存 meat"}),!i&&r.jsx("button",{className:"button",disabled:M,onClick:()=>{E(),l(Array.from(j.current.keys()).filter(e=>j.current[e]),!0,S)},children:"保存并标注下一张"})]})]})}function Ge({data:t,busy:o,onSave:l,onSaveSemantic:v,onDirty:i}){const[c,m]=s.useState(!1),[f,h]=s.useState(!1),a=ye.useCallback(d=>{h(d),i(d)},[i]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"semantic-tabs",role:"tablist","aria-label":"标注层级",children:[r.jsx("button",{role:"tab","aria-selected":!c,disabled:f||o,onClick:()=>m(!1),children:"meat 二分类"}),r.jsx("button",{role:"tab","aria-selected":c,disabled:f||o,onClick:()=>m(!0),children:"细分类(可选)"}),r.jsx("small",{children:f?"保存或撤销修改后可切换标签层。":"已有 meat 标注保留,细分类独立保存。"})]}),r.jsx(Fe,{data:t,semantic:c,busy:o,onSave:c?v:l,onDirty:a},`${c}-${t.semantic?.semantic_revision}`)]})}export{Ge as default}; diff --git a/best_annotator/static/assets/MeatEditor-BnFhxK7E.js b/best_annotator/static/assets/MeatEditor-BnFhxK7E.js new file mode 100644 index 0000000000000000000000000000000000000000..2e2e5301de7988782aa9cd6cb04d5c765aec9b50 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-BnFhxK7E.js @@ -0,0 +1,14 @@ +import{r as s,R as ye,j as r,M as Me}from"./index-Cwjw6kcd.js";import{aA as je,h as he,am as we,t as Ce,u as q,ae as Ee,D as Se,m as de,aw as ke,a0 as Ae,a3 as Pe,ay as Ne,aE as se}from"./OrbitControls-D8dMCyiM.js";const Ue=["left","right","top","bottom","front","back"];function ge(t,o){const[l,v,i]=t.size,c=t.inflate,m=new je(l+c,v+c,i+c,l,v,i),f=m.toNonIndexed();m.dispose();const h=f.getAttribute("position"),a=f.getAttribute("uv"),d=[],g=[],p=[],b=[],S=[],w=new he;for(const A of f.groups){const[N,L,T,B,j,X]=t.faces[Ue[A.materialIndex]];for(let C=A.start;C{v.array[f]=o[m]?1:0}),v.needsUpdate=!0;const i=t.getAttribute("meatColor"),c=new he;t.userData.vertexIds.forEach((m,f)=>{c.set(l?.[o[m]]||"#19ff9d"),i.setXYZ(f,c.r,c.g,c.b)}),i.needsUpdate=!0}function Re(t,o){const l=Array.from({length:4096},()=>new Set);for(const v of t){const i=ge(v,o),c=new Map,m=i.getAttribute("position"),f=i.userData.triangleIds,h=a=>[m.getX(a),m.getY(a),m.getZ(a)].map(d=>Math.round(d*1e4)).join(",");for(let a=0;aArray.from(v))}function De(t){const o=new Ee({vertexColors:!0,side:Se});return o.onBeforeCompile=l=>{l.uniforms.meatPulse=t,l.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.vertexShader,l.vertexShader=l.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),l.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.fragmentShader,l.fragmentShader=l.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},o.customProgramCacheKey=()=>"meat-pulse-grid-v3",o}function Te(t,o,l,v,i,c){if(!l[t]||!v[t])return[];const m=Math.max(0,Math.min(100,Number(c)||0)),f=new Uint8Array(4096),h=[t],a=[];for(f[t]=1;h.length;){const d=h.pop();if(!l[d]||!v[d])continue;let g=0;for(let p=0;p<3;p++)g+=(o[d*4+p]-o[t*4+p])**2;if(!(Math.sqrt(g/3)/255*100>m+1e-9)){a.push(d);for(const p of i[d])f[p]||(f[p]=1,h.push(p))}}return a}function Ve(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function fe(t,o){t&&t.pointerId===o.pointerId&&Math.hypot(o.clientX-t.x,o.clientY-t.y)>5&&(t.dragged=!0)}function _e(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const H=[0,-2,0];function Le(t,o,l){const i={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[o];t.up.set(...o==="top"?[0,0,-1]:o==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...i.map((c,m)=>c+H[m])),t.lookAt(...H),l&&(l.target.set(...H),l.update()),t.updateMatrixWorld()}const me=t=>Uint8Array.from(atob(t),o=>o.charCodeAt(0)),oe=t=>{const o=new Uint8Array(4096);return t.forEach(l=>o[l]=1),o};function Oe({part:t,rgba:o,mask:l,palette:v,pulse:i,pickDown:c,pickUp:m,hover:f}){const h=s.useMemo(()=>ge(t,o),[t,o]),a=s.useMemo(()=>De(i),[i]);s.useEffect(()=>{Ie(h,l,v)},[h,l,v]),s.useEffect(()=>()=>{h.dispose(),a.dispose()},[h,a]);const d=(g,p)=>{g.stopPropagation();const b=h.userData.triangleIds[g.faceIndex];b!==void 0&&(f(b),p==="down"&&c(b),p==="up"&&m())};return r.jsx("mesh",{geometry:h,material:a,position:t.center,onPointerDown:g=>d(g,"down"),onPointerMove:g=>d(g,"hover"),onPointerUp:g=>d(g,"up")})}function Ye({data:t,rgba:o,mask:l,palette:v,layer:i,animate:c,view:m,viewEpoch:f,pickDown:h,pickUp:a,hover:d}){const g=s.useMemo(()=>({value:.85}),[]),p=s.useRef(),{camera:b,size:S}=Ae();return Pe(({clock:w})=>{g.value=c?.68+.28*Math.sin(w.elapsedTime*Math.PI):.85}),s.useEffect(()=>{Le(b,m,p.current)},[m,f,b]),s.useEffect(()=>{b.zoom=Math.min(S.width/36,S.height/42),b.updateProjectionMatrix()},[b,S.width,S.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(w=>i==="both"||w.layer===(i==="inner"?0:1)).map(w=>r.jsx(Oe,{part:w,rgba:o,mask:l,palette:v,pulse:g,pickDown:h,pickUp:a,hover:d},w.name+w.layer)),r.jsx(Ne,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:se.ROTATE,MIDDLE:se.DOLLY,RIGHT:se.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:o,onSave:l,onDirty:v,semantic:i=!1}){const[c,m]=s.useState(2),[f,h]=s.useState(""),a=t.semantic?.classes||[],d=s.useMemo(()=>i?Object.fromEntries(a.map(e=>[e.id,e.color])):void 0,[i,t.semantic]),g=s.useMemo(()=>oe(t.selected),[t.selected]),[p,b]=s.useState(!1),[S,w]=s.useState(null),M=o||p||i&&!t.semantic?.available,A=s.useMemo(()=>me(t.rgba),[t.rgba]),N=s.useMemo(()=>me(t.valid),[t.valid]),L=s.useMemo(()=>i?Uint8Array.from(t.semantic.labels):oe(t.selected),[t,i]),[T,B]=s.useState(L),j=s.useRef(L),[X,C]=s.useState("toggle"),[V,G]=s.useState("both"),[K,W]=s.useState("front"),[U,P]=s.useState(12),[J,Q]=s.useState(0),pe=s.useMemo(()=>Re(t.parts,A),[t.parts,A]),[Z,ve]=s.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[O,ae]=s.useState(null),[Y,ee]=s.useState({entries:[L],index:0}),F=s.useRef(null),ie=s.useRef(null),te=s.useRef(T),I=s.useRef(null),le=s.useMemo(()=>({selected:T.reduce((e,n)=>e+(n>0?1:0),0),valid:N.reduce((e,n)=>e+n,0)}),[T,N]),z=T.some((e,n)=>e!==L[n]),$=s.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{V!=="both"&&n.layer!==(V==="inner"?0:1)||Object.values(n.faces).forEach(([x,y,k,R])=>{for(let D=y;D{j.current=e,te.current=e,B(e)},E=()=>{F.current&&(j.current.some((e,n)=>e!==F.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),F.current=null)},ce=(e,n=!1,x=!1)=>{if(M||!N[e]||!$[e]||(n&&(E(),F.current={before:j.current,value:X==="erase"||j.current[e]===(i?c:1)?0:i?c:1,flood:x}),!F.current)||!n&&F.current.flood)return;const y=F.current.value,k=x&&n?Te(e,A,N,$,pe,U):[e];if(k.every(u=>j.current[u]===y))return;const R=i&&y?a.find(u=>u.id===y).meat:null,D=k.filter(u=>R===null||!!g[u]===R);h(D.length_[u]=y),ne(_)},xe=e=>{I.current&&(I.current.id=e)},be=()=>{const e=I.current;_e(e)&&(ce(e.id,!0,e.ctrl),E()),e&&(e.cancelled=!0)};s.useEffect(()=>{v(z)},[z,v]),s.useEffect(()=>(window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",E),()=>{window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",E)}),[]),s.useEffect(()=>{const e=n=>{z&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[z]);const re=e=>{if(M)return;E();const n=Y.index+e;n<0||n>=Y.entries.length||(ne(Y.entries[n]),ee({...Y,index:n}))};s.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),re(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),s.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),x=document.createElement("canvas");x.width=64,x.height=64,x.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(A),64,64),0,0);let y,k=0;const R=D=>{if(D-k>40){k=D,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(x,0,0,512,512);const _=Z?.68+.28*Math.sin(D/1e3*Math.PI):.85;for(let u=0;u<4096;u++)(!N[u]||!$[u])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(u%64*8,Math.floor(u/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let u=0;u<=64;u++)n.moveTo(u*8,0),n.lineTo(u*8,512),n.moveTo(0,u*8),n.lineTo(512,u*8);n.stroke();for(let u=0;u<4096;u++)N[u]&&$[u]&&te.current[u]&&(n.strokeStyle="#03140d",n.globalAlpha=_*.65,n.lineWidth=1.8,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.strokeStyle=d?.[te.current[u]]||"#19ff9d",n.globalAlpha=_,n.lineWidth=1,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.globalAlpha=1);O!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(O%64*8+1,Math.floor(O/64)*8+1,6,6))}y=requestAnimationFrame(R)};return y=requestAnimationFrame(R),()=>cancelAnimationFrame(y)},[A,N,$,Z,O,d]);const ue=(e,n)=>{const x=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-x.left)/x.width*64),k=Math.floor((e.clientY-x.top)/x.height*64);if(y<0||y>=64||k<0||k>=64)return;const R=k*64+y;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),ce(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsxs("p",{className:"meat-definition",children:["meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。按各个面正对的正交投影,完全被外层遮住的内层格已透明排除(",t.occluded_count||0," 格);斜视时露出不改变此规则。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),!i&&r.jsx(Me,{data:t,disabled:M,onStart:()=>{E(),b(!0)},onEnd:()=>b(!1),onApply:e=>{const n=oe(e.selected);ne(n),ee(x=>{const y=[...x.entries.slice(0,x.index+1),n].slice(-60);return{entries:y,index:y.length-1}}),w({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),i&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"meat-definition",children:"细分类可只标容易混淆的格子,未细标格为“未知”,仍保留原 meat 标签参与二分类训练。细分类只包含裸露皮肤、眼睛、嘴巴、眉毛、胡子;头发、眼镜、衣饰不单独细分,仍属于非 meat。"}),!t.semantic.available&&r.jsx("p",{className:"meat-warning",children:"请先保存 meat 二分类,再补细分类。"}),t.semantic.status==="needs_review"&&r.jsxs("p",{className:"meat-warning",children:["标签定义或二分类曾变化,已忽略 ",t.semantic.conflict_count," 个冲突/已移除类别的细标签;请复核并保存,其余细标签已保留。"]}),t.semantic.status==="stale"&&r.jsx("p",{className:"meat-warning",children:"原皮肤已变化,旧细分类已停用;保存时将归档旧文件。"}),r.jsxs("label",{className:"semantic-category",children:["细分类 ",r.jsx("select",{"aria-label":"细分类类别",value:c,onChange:e=>m(Number(e.target.value)),children:a.map(e=>r.jsxs("option",{value:e.id,children:[e.label," · ",e.meat?"meat":"非 meat"]},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:a.map(e=>r.jsxs("button",{className:c===e.id?"active":"",style:{borderColor:e.color},onClick:()=>m(e.id),children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))})]}),f&&r.jsx("p",{role:"status",className:"meat-warning",children:f}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:X==="toggle"?"active":"",onClick:()=>C("toggle"),children:"点击切换选中"}),r.jsx("button",{className:X==="erase"?"active":"",onClick:()=>C("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>P(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:V,onChange:e=>G(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:M||Y.index===0,onClick:()=>re(-1),children:"撤销"}),r.jsx("button",{disabled:M||Y.index===Y.entries.length-1,onClick:()=>re(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:Z,onChange:e=>ve(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:K===e?"active":"",onClick:()=>{W(e),Q(x=>x+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=Ve(e)},onPointerMoveCapture:e=>fe(I.current,e),onPointerUpCapture:e=>fe(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(ke,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Ye,{data:t,rgba:A,mask:T,palette:d,layer:V,animate:Z,view:K,viewEpoch:J,pickDown:xe,pickUp:be,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:O===null?"透明区域不参与标注":`UV (${O%64}, ${Math.floor(O/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ue(e,!0),onPointerMove:e=>ue(e,!1),onPointerUp:E})]})]}),r.jsxs("p",{className:"meat-help",children:["拖动后可点视角按钮回到正对方向,核对完全遮挡的格子。",i?"不同颜色的网格边框表示细分类;擦除仅恢复为未知,不改变 meat":"绿色网格边框表示选中的 meat",",格子内部保留皮肤原色。Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"]}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",le.selected," / ",le.valid," 格",z?" · 未保存":"",r.jsx("small",{children:i?`保存为 ${t.id}_semantic.png;未细标的格为未知,原 meat 文件保持不变。`:`保存为 ${t.id}_meat.png;未选择的有效格为非 meat。`})]}),r.jsx("button",{className:"button secondary",disabled:M,onClick:()=>{E(),l(i?Array.from(j.current):Array.from(j.current.keys()).filter(e=>j.current[e]),!1,S)},children:i?"保存细分类":"保存 meat"}),!i&&r.jsx("button",{className:"button",disabled:M,onClick:()=>{E(),l(Array.from(j.current.keys()).filter(e=>j.current[e]),!0,S)},children:"保存并标注下一张"})]})]})}function Ge({data:t,busy:o,onSave:l,onSaveSemantic:v,onDirty:i}){const[c,m]=s.useState(!1),[f,h]=s.useState(!1),a=ye.useCallback(d=>{h(d),i(d)},[i]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"semantic-tabs",role:"tablist","aria-label":"标注层级",children:[r.jsx("button",{role:"tab","aria-selected":!c,disabled:f||o,onClick:()=>m(!1),children:"meat 二分类"}),r.jsx("button",{role:"tab","aria-selected":c,disabled:f||o,onClick:()=>m(!0),children:"细分类(可选)"}),r.jsx("small",{children:f?"保存或撤销修改后可切换标签层。":"已有 meat 标注保留,细分类独立保存。"})]}),r.jsx(Fe,{data:t,semantic:c,busy:o,onSave:c?v:l,onDirty:a},`${c}-${t.semantic?.semantic_revision}`)]})}export{Ge as default}; diff --git a/best_annotator/static/assets/MeatEditor-BoUWELYo.js b/best_annotator/static/assets/MeatEditor-BoUWELYo.js new file mode 100644 index 0000000000000000000000000000000000000000..8a4616eee24a96a05e89e616b41ae4272e1a94a7 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-BoUWELYo.js @@ -0,0 +1,5 @@ +import{r as a,j as r}from"./index-BwpaCc7o.js";import{aA as re,h as oe,am as se,t as ie,u as q,ae,D as ce,aw as le,a0 as ue,a3 as fe,ay as de,aE as H}from"./OrbitControls-C_CiZNu6.js";const me=["left","right","top","bottom","front","back"];function ee(t,s){const[c,m,d]=t.size,f=t.inflate,x=new re(c+f,m+f,d+f,c,m,d),u=x.toNonIndexed();x.dispose();const h=u.getAttribute("position"),o=u.getAttribute("uv"),i=[],p=[],l=[],g=[],N=new oe;for(const P of u.groups){const[X,K,Y,F,L,V]=t.faces[me[P.materialIndex]];for(let v=P.start;v{c.array[d]=s[m]?1:0}),c.needsUpdate=!0}function pe(t,s){const c=Array.from({length:4096},()=>new Set);for(const m of t){const d=ee(m,s),f=new Map,x=d.getAttribute("position"),u=d.userData.triangleIds,h=o=>[x.getX(o),x.getY(o),x.getZ(o)].map(i=>Math.round(i*1e4)).join(",");for(let o=0;oArray.from(m))}function ge(t){const s=new ae({vertexColors:!0,side:ce});return s.onBeforeCompile=c=>{c.uniforms.meatPulse=t,c.vertexShader=`attribute float meatSelected; varying float vMeatSelected; +`+c.vertexShader,c.vertexShader=c.vertexShader.replace("#include ",`#include +vMeatSelected = meatSelected;`),c.fragmentShader=`uniform float meatPulse; varying float vMeatSelected; +`+c.fragmentShader,c.fragmentShader=c.fragmentShader.replace("#include ",`#include +diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.04, 1.0, 0.46), vMeatSelected * meatPulse);`)},s.customProgramCacheKey=()=>"meat-pulse-v1",s}function ve(t,s,c,m,d,f){if(!c[t]||!m[t])return[];const x=Math.max(0,Math.min(100,Number(f)||0)),u=new Uint8Array(4096),h=[t],o=[];for(u[t]=1;h.length;){const i=h.pop();if(!c[i]||!m[i])continue;let p=0;for(let l=0;l<3;l++)p+=(s[i*4+l]-s[t*4+l])**2;if(!(Math.sqrt(p/3)/255*100>x+1e-9)){o.push(i);for(const l of d[i])u[l]||(u[l]=1,h.push(l))}}return o}function xe(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function J(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function be(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const Q=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0)),we=t=>{const s=new Uint8Array(4096);return t.forEach(c=>s[c]=1),s};function ye({part:t,rgba:s,mask:c,pulse:m,pickDown:d,pickUp:f,hover:x}){const u=a.useMemo(()=>ee(t,s),[t,s]),h=a.useMemo(()=>ge(m),[m]);a.useEffect(()=>{he(u,c)},[u,c]),a.useEffect(()=>()=>{u.dispose(),h.dispose()},[u,h]);const o=(i,p)=>{i.stopPropagation();const l=u.userData.triangleIds[i.faceIndex];l!==void 0&&(x(l),p==="down"&&d(l),p==="up"&&f())};return r.jsx("mesh",{geometry:u,material:h,position:t.center,onPointerDown:i=>o(i,"down"),onPointerMove:i=>o(i,"hover"),onPointerUp:i=>o(i,"up")})}function je({data:t,rgba:s,mask:c,layer:m,animate:d,view:f,viewEpoch:x,pickDown:u,pickUp:h,hover:o}){const i=a.useMemo(()=>({value:.6}),[]),p=a.useRef(),{camera:l}=ue();return fe(({clock:g})=>{i.value=d?.48+.28*Math.sin(g.elapsedTime*Math.PI):.6}),a.useEffect(()=>{const g={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,50,.01],bottom:[0,-52,.01]};l.position.set(...g[f]),l.lookAt(0,-2,0),p.current?.update()},[f,x,l]),r.jsxs(r.Fragment,{children:[t.parts.filter(g=>m==="both"||g.layer===(m==="inner"?0:1)).map(g=>r.jsx(ye,{part:g,rgba:s,mask:c,pulse:i,pickDown:u,pickUp:h,hover:o},g.name+g.layer)),r.jsx(de,{ref:p,target:[0,-2,0],enablePan:!1,mouseButtons:{LEFT:H.ROTATE,MIDDLE:H.DOLLY,RIGHT:H.ROTATE},minDistance:10,maxDistance:100})]})}function Se({data:t,busy:s,onSave:c,onDirty:m}){const d=a.useMemo(()=>Q(t.rgba),[t.rgba]),f=a.useMemo(()=>Q(t.valid),[t.valid]),x=a.useMemo(()=>we(t.selected),[t]),[u,h]=a.useState(x),o=a.useRef(x),[i,p]=a.useState("toggle"),[l,g]=a.useState("both"),[N,R]=a.useState("angle"),[P,X]=a.useState(12),[K,Y]=a.useState(0),F=a.useMemo(()=>pe(t.parts,d),[t.parts,d]),[L,V]=a.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[v,T]=a.useState(null),[M,G]=a.useState({entries:[x],index:0}),I=a.useRef(null),A=a.useRef(null),D=a.useRef(u),E=a.useRef(null),$=a.useMemo(()=>({selected:u.reduce((e,n)=>e+n,0),valid:f.reduce((e,n)=>e+n,0)}),[u,f]),U=u.some((e,n)=>e!==x[n]),O=a.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{l!=="both"&&n.layer!==(l==="inner"?0:1)||Object.values(n.faces).forEach(([b,y,C,k])=>{for(let S=y;S{o.current=e,D.current=e,h(e)},j=()=>{I.current&&(o.current.some((e,n)=>e!==I.current.before[n])&&G(e=>{const n=[...e.entries.slice(0,e.index+1),o.current].slice(-60);return{entries:n,index:n.length-1}}),I.current=null)},W=(e,n=!1,b=!1)=>{if(s||!f[e]||!O[e]||(n&&(j(),I.current={before:o.current,value:i==="erase"?0:1-o.current[e],flood:b}),!I.current)||!n&&I.current.flood)return;const y=I.current.value,C=b&&n?ve(e,d,f,O,F,P):[e];if(C.every(S=>o.current[S]===y))return;const k=o.current.slice();C.forEach(S=>k[S]=y),z(k)},te=e=>{E.current&&(E.current.id=e)},ne=()=>{const e=E.current;be(e)&&(W(e.id,!0,e.ctrl),j()),e&&(e.cancelled=!0)};a.useEffect(()=>{m(U)},[U,m]),a.useEffect(()=>(window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),window.addEventListener("blur",j),()=>{window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",j)}),[]),a.useEffect(()=>{const e=n=>{U&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[U]);const _=e=>{if(s)return;j();const n=M.index+e;n<0||n>=M.entries.length||(z(M.entries[n]),G({...M,index:n}))};a.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),_(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),a.useEffect(()=>{const e=A.current,n=e.getContext("2d"),b=document.createElement("canvas");b.width=64,b.height=64,b.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(d),64,64),0,0);let y,C=0;const k=S=>{if(S-C>40){C=S,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(b,0,0,512,512);const B=L?.48+.28*Math.sin(S/1e3*Math.PI):.6;for(let w=0;w<4096;w++)!f[w]||!O[w]?(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(w%64*8,Math.floor(w/64)*8,8,8)):D.current[w]&&(n.fillStyle=`rgba(25,255,157,${B})`,n.fillRect(w%64*8,Math.floor(w/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let w=0;w<=64;w++)n.moveTo(w*8,0),n.lineTo(w*8,512),n.moveTo(0,w*8),n.lineTo(512,w*8);n.stroke(),v!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(v%64*8+1,Math.floor(v/64)*8+1,6,6))}y=requestAnimationFrame(k)};return y=requestAnimationFrame(k),()=>cancelAnimationFrame(y)},[d,f,O,L,v]);const Z=(e,n)=>{const b=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-b.left)/b.width*64),C=Math.floor((e.clientY-b.top)/b.height*64);if(y<0||y>=64||C<0||C>=64)return;const k=C*64+y;T(k),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),W(k,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。"}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:i==="toggle"?"active":"",onClick:()=>p("toggle"),children:"点击切换选中"}),r.jsx("button",{className:i==="erase"?"active":"",onClick:()=>p("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:P,onChange:e=>X(Number(e.target.value))}),r.jsxs("output",{children:[P,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:l,onChange:e=>g(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:s||M.index===0,onClick:()=>_(-1),children:"撤销"}),r.jsx("button",{disabled:s||M.index===M.entries.length-1,onClick:()=>_(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:L,onChange:e=>V(e.target.checked)}),"呼吸高亮"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"拖拽旋转 · 点击切换 · Ctrl+点击泛洪 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({angle:"斜视",front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部"}).map(([e,n])=>r.jsx("button",{className:N===e?"active":"",onClick:()=>{R(e),Y(b=>b+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?E.current&&(E.current.cancelled=!0):E.current=xe(e)},onPointerMoveCapture:e=>J(E.current,e),onPointerUpCapture:e=>J(E.current,e),onPointerCancelCapture:()=>{E.current&&(E.current.cancelled=!0)},children:r.jsx(le,{camera:{position:[30,22,38],fov:43},children:r.jsx(je,{data:t,rgba:d,mask:u,layer:l,animate:L,view:N,viewEpoch:K,pickDown:te,pickUp:ne,hover:T})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:v===null?"可标注被遮住的表面":`UV (${v%64}, ${Math.floor(v/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:A,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>Z(e,!0),onPointerMove:e=>Z(e,!1),onPointerUp:j})]})]}),r.jsx("p",{className:"meat-help",children:"Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",$.selected," / ",$.valid," 格",U?" · 未保存":"",r.jsxs("small",{children:["保存为 ",t.id,"_meat.png;未选择的有效格为非 meat。"]})]}),r.jsx("button",{className:"button secondary",disabled:s,onClick:()=>{j(),c(Array.from(o.current.keys()).filter(e=>o.current[e]),!1)},children:"保存 meat"}),r.jsx("button",{className:"button",disabled:s,onClick:()=>{j(),c(Array.from(o.current.keys()).filter(e=>o.current[e]),!0)},children:"保存并标注下一张"})]})]})}export{Se as default}; diff --git a/best_annotator/static/assets/MeatEditor-C-IGVOEE.js b/best_annotator/static/assets/MeatEditor-C-IGVOEE.js new file mode 100644 index 0000000000000000000000000000000000000000..ac9510a155de1a33bde29c7d9ac3e4fbf2a32de3 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-C-IGVOEE.js @@ -0,0 +1,14 @@ +import{r as i,j as r,M as ue}from"./index-DqXMzOA0.js";import{aA as de,h as fe,am as me,t as he,u as W,ae as ge,D as pe,m as re,aw as ve,a0 as xe,a3 as be,ay as ye,aE as Z}from"./OrbitControls-CHt0YeD1.js";const we=["left","right","top","bottom","front","back"];function ae(n,a){const[l,h,b]=n.size,p=n.inflate,w=new de(l+p,h+p,b+p,l,h,b),d=w.toNonIndexed();w.dispose();const u=d.getAttribute("position"),o=d.getAttribute("uv"),s=[],f=[],c=[],v=[],M=[],T=new fe;for(const k of d.groups){const[G,O,Y,V,K,q]=n.faces[we[k.materialIndex]];for(let C=k.start;C{l.array[b]=a[h]?1:0}),l.needsUpdate=!0}function je(n,a){const l=Array.from({length:4096},()=>new Set);for(const h of n){const b=ae(h,a),p=new Map,w=b.getAttribute("position"),d=b.userData.triangleIds,u=o=>[w.getX(o),w.getY(o),w.getZ(o)].map(s=>Math.round(s*1e4)).join(",");for(let o=0;oArray.from(h))}function Ce(n){const a=new ge({vertexColors:!0,side:pe});return a.onBeforeCompile=l=>{l.uniforms.meatPulse=n,l.vertexShader=`attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.vertexShader,l.vertexShader=l.vertexShader.replace("#include ",`#include +vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),l.fragmentShader=`uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.fragmentShader,l.fragmentShader=l.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.04, 1.0, 0.46), vMeatSelected * outline * meatPulse); + `)},a.customProgramCacheKey=()=>"meat-pulse-grid-v2",a}function Ee(n,a,l,h,b,p){if(!l[n]||!h[n])return[];const w=Math.max(0,Math.min(100,Number(p)||0)),d=new Uint8Array(4096),u=[n],o=[];for(d[n]=1;u.length;){const s=u.pop();if(!l[s]||!h[s])continue;let f=0;for(let c=0;c<3;c++)f+=(a[s*4+c]-a[n*4+c])**2;if(!(Math.sqrt(f/3)/255*100>w+1e-9)){o.push(s);for(const c of b[s])d[c]||(d[c]=1,u.push(c))}}return o}function Se(n){return{pointerId:n.pointerId,x:n.clientX,y:n.clientY,ctrl:n.ctrlKey,button:n.button,dragged:!1,cancelled:!n.isPrimary&&n.isPrimary!==void 0}}function oe(n,a){n&&n.pointerId===a.pointerId&&Math.hypot(a.clientX-n.x,a.clientY-n.y)>5&&(n.dragged=!0)}function ke(n){return!!n&&!n.dragged&&!n.cancelled&&(n.button===0||n.button===2&&n.ctrl)&&Number.isInteger(n.id)}const se=n=>Uint8Array.from(atob(n),a=>a.charCodeAt(0)),ie=n=>{const a=new Uint8Array(4096);return n.forEach(l=>a[l]=1),a};function Pe({part:n,rgba:a,mask:l,pulse:h,pickDown:b,pickUp:p,hover:w}){const d=i.useMemo(()=>ae(n,a),[n,a]),u=i.useMemo(()=>Ce(h),[h]);i.useEffect(()=>{Me(d,l)},[d,l]),i.useEffect(()=>()=>{d.dispose(),u.dispose()},[d,u]);const o=(s,f)=>{s.stopPropagation();const c=d.userData.triangleIds[s.faceIndex];c!==void 0&&(w(c),f==="down"&&b(c),f==="up"&&p())};return r.jsx("mesh",{geometry:d,material:u,position:n.center,onPointerDown:s=>o(s,"down"),onPointerMove:s=>o(s,"hover"),onPointerUp:s=>o(s,"up")})}function Ae({data:n,rgba:a,mask:l,layer:h,animate:b,view:p,viewEpoch:w,pickDown:d,pickUp:u,hover:o}){const s=i.useMemo(()=>({value:.85}),[]),f=i.useRef(),{camera:c}=xe();return be(({clock:v})=>{s.value=b?.68+.28*Math.sin(v.elapsedTime*Math.PI):.85}),i.useEffect(()=>{const v={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,50,.01],bottom:[0,-52,.01]};c.position.set(...v[p]),c.lookAt(0,-2,0),f.current?.update()},[p,w,c]),r.jsxs(r.Fragment,{children:[n.parts.filter(v=>h==="both"||v.layer===(h==="inner"?0:1)).map(v=>r.jsx(Pe,{part:v,rgba:a,mask:l,pulse:s,pickDown:d,pickUp:u,hover:o},v.name+v.layer)),r.jsx(ye,{ref:f,target:[0,-2,0],enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:Z.ROTATE,MIDDLE:Z.DOLLY,RIGHT:Z.ROTATE},minDistance:10,maxDistance:100})]})}function Ie({data:n,busy:a,onSave:l,onDirty:h}){const[b,p]=i.useState(!1),[w,d]=i.useState(null),u=a||b,o=i.useMemo(()=>se(n.rgba),[n.rgba]),s=i.useMemo(()=>se(n.valid),[n.valid]),f=i.useMemo(()=>ie(n.selected),[n]),[c,v]=i.useState(f),M=i.useRef(f),[T,D]=i.useState("toggle"),[k,G]=i.useState("both"),[O,Y]=i.useState("angle"),[V,K]=i.useState(12),[q,C]=i.useState(0),_=i.useMemo(()=>je(n.parts,o),[n.parts,o]),[R,H]=i.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[P,I]=i.useState(null),[x,X]=i.useState({entries:[f],index:0}),N=i.useRef(null),J=i.useRef(null),Q=i.useRef(c),A=i.useRef(null),ee=i.useMemo(()=>({selected:c.reduce((e,t)=>e+t,0),valid:s.reduce((e,t)=>e+t,0)}),[c,s]),B=c.some((e,t)=>e!==f[t]),F=i.useMemo(()=>{const e=new Uint8Array(4096);return n.parts.forEach(t=>{k!=="both"&&t.layer!==(k==="inner"?0:1)||Object.values(t.faces).forEach(([g,y,E,U])=>{for(let S=y;S{M.current=e,Q.current=e,v(e)},j=()=>{N.current&&(M.current.some((e,t)=>e!==N.current.before[t])&&X(e=>{const t=[...e.entries.slice(0,e.index+1),M.current].slice(-60);return{entries:t,index:t.length-1}}),N.current=null)},te=(e,t=!1,g=!1)=>{if(u||!s[e]||!F[e]||(t&&(j(),N.current={before:M.current,value:T==="erase"?0:1-M.current[e],flood:g}),!N.current)||!t&&N.current.flood)return;const y=N.current.value,E=g&&t?Ee(e,o,s,F,_,V):[e];if(E.every(S=>M.current[S]===y))return;const U=M.current.slice();E.forEach(S=>U[S]=y),$(U)},le=e=>{A.current&&(A.current.id=e)},ce=()=>{const e=A.current;ke(e)&&(te(e.id,!0,e.ctrl),j()),e&&(e.cancelled=!0)};i.useEffect(()=>{h(B)},[B,h]),i.useEffect(()=>(window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),window.addEventListener("blur",j),()=>{window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",j)}),[]),i.useEffect(()=>{const e=t=>{B&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[B]);const z=e=>{if(u)return;j();const t=x.index+e;t<0||t>=x.entries.length||($(x.entries[t]),X({...x,index:t}))};i.useEffect(()=>{const e=t=>{(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="z"&&(t.preventDefault(),z(t.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),i.useEffect(()=>{const e=J.current,t=e.getContext("2d"),g=document.createElement("canvas");g.width=64,g.height=64,g.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(o),64,64),0,0);let y,E=0;const U=S=>{if(S-E>40){E=S,t.clearRect(0,0,512,512),t.imageSmoothingEnabled=!1,t.drawImage(g,0,0,512,512);const L=R?.68+.28*Math.sin(S/1e3*Math.PI):.85;for(let m=0;m<4096;m++)(!s[m]||!F[m])&&(t.fillStyle="rgba(27,33,44,.72)",t.fillRect(m%64*8,Math.floor(m/64)*8,8,8));t.strokeStyle="rgba(0,0,0,.18)",t.lineWidth=.5,t.beginPath();for(let m=0;m<=64;m++)t.moveTo(m*8,0),t.lineTo(m*8,512),t.moveTo(0,m*8),t.lineTo(512,m*8);t.stroke(),t.beginPath();for(let m=0;m<4096;m++)s[m]&&F[m]&&Q.current[m]&&t.rect(m%64*8+.5,Math.floor(m/64)*8+.5,7,7);t.strokeStyle=`rgba(3,20,13,${L*.65})`,t.lineWidth=1.8,t.stroke(),t.strokeStyle=`rgba(25,255,157,${L})`,t.lineWidth=1,t.stroke(),P!==null&&(t.strokeStyle="#fff",t.lineWidth=2,t.strokeRect(P%64*8+1,Math.floor(P/64)*8+1,6,6))}y=requestAnimationFrame(U)};return y=requestAnimationFrame(U),()=>cancelAnimationFrame(y)},[o,s,F,R,P]);const ne=(e,t)=>{const g=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-g.left)/g.width*64),E=Math.floor((e.clientY-g.top)/g.height*64);if(y<0||y>=64||E<0||E>=64)return;const U=E*64+y;I(U),(e.buttons===1||t&&e.ctrlKey&&e.button===2)&&(t&&e.currentTarget.setPointerCapture(e.pointerId),te(U,t,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsxs("p",{className:"meat-definition",children:["meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。正交投影被外层完全遮住的内层格已透明排除(",n.occluded_count||0," 格)。"]}),n.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(ue,{data:n,disabled:u,onStart:()=>{j(),p(!0)},onEnd:()=>p(!1),onApply:e=>{const t=ie(e.selected);$(t),X(g=>{const y=[...g.entries.slice(0,g.index+1),t].slice(-60);return{entries:y,index:y.length-1}}),d({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:T==="toggle"?"active":"",onClick:()=>D("toggle"),children:"点击切换选中"}),r.jsx("button",{className:T==="erase"?"active":"",onClick:()=>D("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:V,onChange:e=>K(Number(e.target.value))}),r.jsxs("output",{children:[V,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:k,onChange:e=>G(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:u||x.index===0,onClick:()=>z(-1),children:"撤销"}),r.jsx("button",{disabled:u||x.index===x.entries.length-1,onClick:()=>z(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:R,onChange:e=>H(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"拖拽旋转 · 点击切换 · Ctrl+点击泛洪 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({angle:"斜视",front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部"}).map(([e,t])=>r.jsx("button",{className:O===e?"active":"",onClick:()=>{Y(e),C(g=>g+1)},children:t},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?A.current&&(A.current.cancelled=!0):A.current=Se(e)},onPointerMoveCapture:e=>oe(A.current,e),onPointerUpCapture:e=>oe(A.current,e),onPointerCancelCapture:()=>{A.current&&(A.current.cancelled=!0)},children:r.jsx(ve,{camera:{position:[30,22,38],fov:43},children:r.jsx(Ae,{data:n,rgba:o,mask:c,layer:k,animate:R,view:O,viewEpoch:q,pickDown:le,pickUp:ce,hover:I})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:P===null?"可标注被遮住的表面":`UV (${P%64}, ${Math.floor(P/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:J,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ne(e,!0),onPointerMove:e=>ne(e,!1),onPointerUp:j})]})]}),r.jsx("p",{className:"meat-help",children:"绿色网格边框表示选中的 meat,格子内部保留皮肤原色。Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",ee.selected," / ",ee.valid," 格",B?" · 未保存":"",r.jsxs("small",{children:["保存为 ",n.id,"_meat.png;未选择的有效格为非 meat。"]})]}),r.jsx("button",{className:"button secondary",disabled:u,onClick:()=>{j(),l(Array.from(M.current.keys()).filter(e=>M.current[e]),!1,w)},children:"保存 meat"}),r.jsx("button",{className:"button",disabled:u,onClick:()=>{j(),l(Array.from(M.current.keys()).filter(e=>M.current[e]),!0,w)},children:"保存并标注下一张"})]})]})}export{Ie as default}; diff --git a/best_annotator/static/assets/MeatEditor-C07kxdt0.js b/best_annotator/static/assets/MeatEditor-C07kxdt0.js new file mode 100644 index 0000000000000000000000000000000000000000..e9246a8dca2cf41a4725cf41fc5cf90dc5da15cb --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-C07kxdt0.js @@ -0,0 +1,14 @@ +import{r as l,j as r,M as de}from"./index-CK5rLR8o.js";import{aA as fe,h as me,am as he,t as pe,u as W,ae as ge,D as ve,m as oe,aw as xe,a0 as be,a3 as ye,ay as Me,aE as J}from"./OrbitControls-DmqzLDA6.js";const we=["left","right","top","bottom","front","back"];function le(t,i){const[a,m,x]=t.size,g=t.inflate,b=new fe(a+g,m+g,x+g,a,m,x),f=b.toNonIndexed();b.dispose();const u=f.getAttribute("position"),o=f.getAttribute("uv"),s=[],h=[],c=[],w=[],d=[],N=new me;for(const k of f.groups){const[F,_,O,V,K,z]=t.faces[we[k.materialIndex]];for(let C=k.start;C{a.array[x]=i[m]?1:0}),a.needsUpdate=!0}function Ce(t,i){const a=Array.from({length:4096},()=>new Set);for(const m of t){const x=le(m,i),g=new Map,b=x.getAttribute("position"),f=x.userData.triangleIds,u=o=>[b.getX(o),b.getY(o),b.getZ(o)].map(s=>Math.round(s*1e4)).join(",");for(let o=0;oArray.from(m))}function Ee(t){const i=new ge({vertexColors:!0,side:ve});return i.onBeforeCompile=a=>{a.uniforms.meatPulse=t,a.vertexShader=`attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+a.vertexShader,a.vertexShader=a.vertexShader.replace("#include ",`#include +vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),a.fragmentShader=`uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+a.fragmentShader,a.fragmentShader=a.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.04, 1.0, 0.46), vMeatSelected * outline * meatPulse); + `)},i.customProgramCacheKey=()=>"meat-pulse-grid-v2",i}function Se(t,i,a,m,x,g){if(!a[t]||!m[t])return[];const b=Math.max(0,Math.min(100,Number(g)||0)),f=new Uint8Array(4096),u=[t],o=[];for(f[t]=1;u.length;){const s=u.pop();if(!a[s]||!m[s])continue;let h=0;for(let c=0;c<3;c++)h+=(i[s*4+c]-i[t*4+c])**2;if(!(Math.sqrt(h/3)/255*100>b+1e-9)){o.push(s);for(const c of x[s])f[c]||(f[c]=1,u.push(c))}}return o}function ke(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function se(t,i){t&&t.pointerId===i.pointerId&&Math.hypot(i.clientX-t.x,i.clientY-t.y)>5&&(t.dragged=!0)}function Ae(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const H=[0,-2,0];function Pe(t,i,a){const x={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[i];t.up.set(...i==="top"?[0,0,-1]:i==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...x.map((g,b)=>g+H[b])),t.lookAt(...H),a&&(a.target.set(...H),a.update()),t.updateMatrixWorld()}const ie=t=>Uint8Array.from(atob(t),i=>i.charCodeAt(0)),ae=t=>{const i=new Uint8Array(4096);return t.forEach(a=>i[a]=1),i};function Ue({part:t,rgba:i,mask:a,pulse:m,pickDown:x,pickUp:g,hover:b}){const f=l.useMemo(()=>le(t,i),[t,i]),u=l.useMemo(()=>Ee(m),[m]);l.useEffect(()=>{je(f,a)},[f,a]),l.useEffect(()=>()=>{f.dispose(),u.dispose()},[f,u]);const o=(s,h)=>{s.stopPropagation();const c=f.userData.triangleIds[s.faceIndex];c!==void 0&&(b(c),h==="down"&&x(c),h==="up"&&g())};return r.jsx("mesh",{geometry:f,material:u,position:t.center,onPointerDown:s=>o(s,"down"),onPointerMove:s=>o(s,"hover"),onPointerUp:s=>o(s,"up")})}function Ie({data:t,rgba:i,mask:a,layer:m,animate:x,view:g,viewEpoch:b,pickDown:f,pickUp:u,hover:o}){const s=l.useMemo(()=>({value:.85}),[]),h=l.useRef(),{camera:c,size:w}=be();return ye(({clock:d})=>{s.value=x?.68+.28*Math.sin(d.elapsedTime*Math.PI):.85}),l.useEffect(()=>{Pe(c,g,h.current)},[g,b,c]),l.useEffect(()=>{c.zoom=Math.min(w.width/36,w.height/42),c.updateProjectionMatrix()},[c,w.width,w.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(d=>m==="both"||d.layer===(m==="inner"?0:1)).map(d=>r.jsx(Ue,{part:d,rgba:i,mask:a,pulse:s,pickDown:f,pickUp:u,hover:o},d.name+d.layer)),r.jsx(Me,{ref:h,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:J.ROTATE,MIDDLE:J.DOLLY,RIGHT:J.ROTATE},minZoom:2,maxZoom:100})]})}function Ne({data:t,busy:i,onSave:a,onDirty:m}){const[x,g]=l.useState(!1),[b,f]=l.useState(null),u=i||x,o=l.useMemo(()=>ie(t.rgba),[t.rgba]),s=l.useMemo(()=>ie(t.valid),[t.valid]),h=l.useMemo(()=>ae(t.selected),[t]),[c,w]=l.useState(h),d=l.useRef(h),[N,I]=l.useState("toggle"),[k,F]=l.useState("both"),[_,O]=l.useState("front"),[V,K]=l.useState(12),[z,C]=l.useState(0),Y=l.useMemo(()=>Ce(t.parts,o),[t.parts,o]),[R,q]=l.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[A,T]=l.useState(null),[y,X]=l.useState({entries:[h],index:0}),D=l.useRef(null),Q=l.useRef(null),ee=l.useRef(c),P=l.useRef(null),te=l.useMemo(()=>({selected:c.reduce((e,n)=>e+n,0),valid:s.reduce((e,n)=>e+n,0)}),[c,s]),B=c.some((e,n)=>e!==h[n]),G=l.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{k!=="both"&&n.layer!==(k==="inner"?0:1)||Object.values(n.faces).forEach(([v,M,E,U])=>{for(let S=M;S{d.current=e,ee.current=e,w(e)},j=()=>{D.current&&(d.current.some((e,n)=>e!==D.current.before[n])&&X(e=>{const n=[...e.entries.slice(0,e.index+1),d.current].slice(-60);return{entries:n,index:n.length-1}}),D.current=null)},ne=(e,n=!1,v=!1)=>{if(u||!s[e]||!G[e]||(n&&(j(),D.current={before:d.current,value:N==="erase"?0:1-d.current[e],flood:v}),!D.current)||!n&&D.current.flood)return;const M=D.current.value,E=v&&n?Se(e,o,s,G,Y,V):[e];if(E.every(S=>d.current[S]===M))return;const U=d.current.slice();E.forEach(S=>U[S]=M),Z(U)},ce=e=>{P.current&&(P.current.id=e)},ue=()=>{const e=P.current;Ae(e)&&(ne(e.id,!0,e.ctrl),j()),e&&(e.cancelled=!0)};l.useEffect(()=>{m(B)},[B,m]),l.useEffect(()=>(window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),window.addEventListener("blur",j),()=>{window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",j)}),[]),l.useEffect(()=>{const e=n=>{B&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[B]);const $=e=>{if(u)return;j();const n=y.index+e;n<0||n>=y.entries.length||(Z(y.entries[n]),X({...y,index:n}))};l.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),$(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),l.useEffect(()=>{const e=Q.current,n=e.getContext("2d"),v=document.createElement("canvas");v.width=64,v.height=64,v.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(o),64,64),0,0);let M,E=0;const U=S=>{if(S-E>40){E=S,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(v,0,0,512,512);const L=R?.68+.28*Math.sin(S/1e3*Math.PI):.85;for(let p=0;p<4096;p++)(!s[p]||!G[p])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(p%64*8,Math.floor(p/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let p=0;p<=64;p++)n.moveTo(p*8,0),n.lineTo(p*8,512),n.moveTo(0,p*8),n.lineTo(512,p*8);n.stroke(),n.beginPath();for(let p=0;p<4096;p++)s[p]&&G[p]&&ee.current[p]&&n.rect(p%64*8+.5,Math.floor(p/64)*8+.5,7,7);n.strokeStyle=`rgba(3,20,13,${L*.65})`,n.lineWidth=1.8,n.stroke(),n.strokeStyle=`rgba(25,255,157,${L})`,n.lineWidth=1,n.stroke(),A!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(A%64*8+1,Math.floor(A/64)*8+1,6,6))}M=requestAnimationFrame(U)};return M=requestAnimationFrame(U),()=>cancelAnimationFrame(M)},[o,s,G,R,A]);const re=(e,n)=>{const v=e.currentTarget.getBoundingClientRect(),M=Math.floor((e.clientX-v.left)/v.width*64),E=Math.floor((e.clientY-v.top)/v.height*64);if(M<0||M>=64||E<0||E>=64)return;const U=E*64+M;T(U),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),ne(U,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsxs("p",{className:"meat-definition",children:["meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。按各个面正对的正交投影,完全被外层遮住的内层格已透明排除(",t.occluded_count||0," 格);斜视时露出不改变此规则。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(de,{data:t,disabled:u,onStart:()=>{j(),g(!0)},onEnd:()=>g(!1),onApply:e=>{const n=ae(e.selected);Z(n),X(v=>{const M=[...v.entries.slice(0,v.index+1),n].slice(-60);return{entries:M,index:M.length-1}}),f({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:N==="toggle"?"active":"",onClick:()=>I("toggle"),children:"点击切换选中"}),r.jsx("button",{className:N==="erase"?"active":"",onClick:()=>I("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:V,onChange:e=>K(Number(e.target.value))}),r.jsxs("output",{children:[V,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:k,onChange:e=>F(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:u||y.index===0,onClick:()=>$(-1),children:"撤销"}),r.jsx("button",{disabled:u||y.index===y.entries.length-1,onClick:()=>$(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:R,onChange:e=>q(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:_===e?"active":"",onClick:()=>{O(e),C(v=>v+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?P.current&&(P.current.cancelled=!0):P.current=ke(e)},onPointerMoveCapture:e=>se(P.current,e),onPointerUpCapture:e=>se(P.current,e),onPointerCancelCapture:()=>{P.current&&(P.current.cancelled=!0)},children:r.jsx(xe,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Ie,{data:t,rgba:o,mask:c,layer:k,animate:R,view:_,viewEpoch:z,pickDown:ce,pickUp:ue,hover:T})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:A===null?"透明区域不参与标注":`UV (${A%64}, ${Math.floor(A/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:Q,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>re(e,!0),onPointerMove:e=>re(e,!1),onPointerUp:j})]})]}),r.jsx("p",{className:"meat-help",children:"拖动后可点视角按钮回到正对方向,核对完全遮挡的格子。绿色网格边框表示选中的 meat,格子内部保留皮肤原色。Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",te.selected," / ",te.valid," 格",B?" · 未保存":"",r.jsxs("small",{children:["保存为 ",t.id,"_meat.png;未选择的有效格为非 meat。"]})]}),r.jsx("button",{className:"button secondary",disabled:u,onClick:()=>{j(),a(Array.from(d.current.keys()).filter(e=>d.current[e]),!1,b)},children:"保存 meat"}),r.jsx("button",{className:"button",disabled:u,onClick:()=>{j(),a(Array.from(d.current.keys()).filter(e=>d.current[e]),!0,b)},children:"保存并标注下一张"})]})]})}export{Ne as default}; diff --git a/best_annotator/static/assets/MeatEditor-CAGZvGnO.js b/best_annotator/static/assets/MeatEditor-CAGZvGnO.js new file mode 100644 index 0000000000000000000000000000000000000000..dfdbb8120fe94d420388d03131e4cae8faf27c8a --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-CAGZvGnO.js @@ -0,0 +1,14 @@ +import{j as r,r as i,M as be}from"./index-CzS-rxOV.js";import{aA as ye,h as me,am as we,t as Me,u as q,ae as Ce,D as je,m as ue,aw as Ee,a0 as Se,a3 as ke,ay as Ae,aE as oe}from"./OrbitControls-BNs7WpFn.js";const Pe=["left","right","top","bottom","front","back"];function he(t,s){const[o,u,a]=t.size,l=t.inflate,d=new ye(o+l,u+l,a+l,o,u,a),f=d.toNonIndexed();d.dispose();const v=f.getAttribute("position"),c=f.getAttribute("uv"),m=[],h=[],p=[],x=[],k=[],b=new me;for(const E of f.groups){const[_,N,X,j,W,Y]=t.faces[Pe[E.materialIndex]];for(let S=E.start;S{u.array[f]=s[d]?1:0}),u.needsUpdate=!0;const a=t.getAttribute("meatColor"),l=new me;t.userData.vertexIds.forEach((d,f)=>{l.set(o?.[s[d]]||"#19ff9d"),a.setXYZ(f,l.r,l.g,l.b)}),a.needsUpdate=!0}function Ue(t,s){const o=Array.from({length:4096},()=>new Set);for(const u of t){const a=he(u,s),l=new Map,d=a.getAttribute("position"),f=a.userData.triangleIds,v=c=>[d.getX(c),d.getY(c),d.getZ(c)].map(m=>Math.round(m*1e4)).join(",");for(let c=0;cArray.from(u))}function Ie(t){const s=new Ce({vertexColors:!0,side:je});return s.onBeforeCompile=o=>{o.uniforms.meatPulse=t,o.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.vertexShader,o.vertexShader=o.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),o.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.fragmentShader,o.fragmentShader=o.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},s.customProgramCacheKey=()=>"meat-pulse-grid-v3",s}function De(t,s,o,u,a,l){if(!o[t]||!u[t])return[];const d=Math.max(0,Math.min(100,Number(l)||0)),f=new Uint8Array(4096),v=[t],c=[];for(f[t]=1;v.length;){const m=v.pop();if(!o[m]||!u[m])continue;let h=0;for(let p=0;p<3;p++)h+=(s[m*4+p]-s[t*4+p])**2;if(!(Math.sqrt(h/3)/255*100>d+1e-9)){c.push(m);for(const p of a[m])f[p]||(f[p]=1,v.push(p))}}return c}function Re(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function de(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function _e(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}function Te(t,s){return Uint8Array.from(t,o=>o===s?o:0)}function Ve(t,s,o,u){const a=t.slice();for(const l of s)(u!==0||a[l]===o)&&(a[l]=u);return a}function Le(t,s,o){const u=t.slice(),a=new Set(s);for(let l=0;l<4096;l++)o[l]?(u[l]===0||u[l]===1)&&(u[l]=a.has(l)?1:0):u[l]=0;return u}function Oe(t,s,o){if(!s.semantic_available)return Le(t,s.selected,o);const u=new Set([0,1,2,3,5,6]);if(!Array.isArray(s.labels)||s.labels.length!==4096||s.labels.some(d=>!Number.isInteger(d)||!u.has(d)))throw Error("模型细分类格式无效,未应用预选");const a=Uint8Array.from(s.labels,(d,f)=>o[f]?d:0),l=new Set(s.selected);if(a.some((d,f)=>!!(o[f]&&l.has(f))!==[1,2,3].includes(d)))throw Error("模型细分类与 meat 选区不一致,未应用预选");return a}const H=[0,-2,0];function Ye(t,s,o){const a={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[s];t.up.set(...s==="top"?[0,0,-1]:s==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...a.map((l,d)=>l+H[d])),t.lookAt(...H),o&&(o.target.set(...H),o.update()),t.updateMatrixWorld()}const fe=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0));function Be({part:t,rgba:s,mask:o,palette:u,pulse:a,pickDown:l,pickUp:d,hover:f}){const v=i.useMemo(()=>he(t,s),[t,s]),c=i.useMemo(()=>Ie(a),[a]);i.useEffect(()=>{Ne(v,o,u)},[v,o,u]),i.useEffect(()=>()=>{v.dispose(),c.dispose()},[v,c]);const m=(h,p)=>{h.stopPropagation();const x=v.userData.triangleIds[h.faceIndex];x!==void 0&&(f(x),p==="down"&&l(x),p==="up"&&d())};return r.jsx("mesh",{geometry:v,material:c,position:t.center,onPointerDown:h=>m(h,"down"),onPointerMove:h=>m(h,"hover"),onPointerUp:h=>m(h,"up")})}function Xe({data:t,rgba:s,mask:o,palette:u,layer:a,animate:l,view:d,viewEpoch:f,pickDown:v,pickUp:c,hover:m}){const h=i.useMemo(()=>({value:.85}),[]),p=i.useRef(),{camera:x,size:k}=Se();return ke(({clock:b})=>{h.value=l?.68+.28*Math.sin(b.elapsedTime*Math.PI):.85}),i.useEffect(()=>{Ye(x,d,p.current)},[d,f,x]),i.useEffect(()=>{x.zoom=Math.min(k.width/36,k.height/42),x.updateProjectionMatrix()},[x,k.width,k.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(b=>a==="both"||b.layer===(a==="inner"?0:1)).map(b=>r.jsx(Be,{part:b,rgba:s,mask:o,palette:u,pulse:h,pickDown:v,pickUp:c,hover:m},b.name+b.layer)),r.jsx(Ae,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:oe.ROTATE,MIDDLE:oe.DOLLY,RIGHT:oe.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:s,onSave:o,onDirty:u}){const[a,l]=i.useState(1),d=t.semantic?.classes||[],f=i.useMemo(()=>Object.fromEntries(d.map(e=>[e.id,e.color])),[t.semantic]),v=d.find(e=>e.id===a)?.label||"裸露皮肤",[c,m]=i.useState(!1),[h,p]=i.useState(null),[x,k]=i.useState(!1),b=s||c,C=i.useMemo(()=>fe(t.rgba),[t.rgba]),E=i.useMemo(()=>fe(t.valid),[t.valid]),_=i.useMemo(()=>Uint8Array.from(t.labels),[t]),[N,X]=i.useState(_),j=i.useRef(_),W=i.useMemo(()=>Te(N,a),[N,a]),[Y,S]=i.useState("toggle"),[D,F]=i.useState("both"),[G,Z]=i.useState("front"),[U,A]=i.useState(12),[J,Q]=i.useState(0),pe=i.useMemo(()=>Ue(t.parts,C),[t.parts,C]),[$,ge]=i.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[T,ae]=i.useState(null),[V,ee]=i.useState({entries:[_],index:0}),L=i.useRef(null),ie=i.useRef(null),te=i.useRef(N),I=i.useRef(null),ne=i.useMemo(()=>({selected:N.reduce((e,n)=>e+(n>0?1:0),0),active:N.reduce((e,n)=>e+(n===a?1:0),0),valid:E.reduce((e,n)=>e+n,0)}),[N,E,a]),K=x||N.some((e,n)=>e!==_[n]),z=i.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{D!=="both"&&n.layer!==(D==="inner"?0:1)||Object.values(n.faces).forEach(([y,w,P,R])=>{for(let O=w;O{j.current=e,te.current=e,X(e),k(!1)},M=()=>{L.current&&(j.current.some((e,n)=>e!==L.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),L.current=null)},le=(e,n=!1,y=!1)=>{if(b||!E[e]||!z[e]||(n&&(M(),L.current={before:j.current,value:Y==="erase"||j.current[e]===a?0:a,flood:y}),!L.current)||!n&&L.current.flood)return;const w=L.current.value,P=y&&n?De(e,C,E,z,pe,U):[e];P.every(R=>j.current[R]===w)||re(Ve(j.current,P,a,w))},ve=e=>{I.current&&(I.current.id=e)},xe=()=>{const e=I.current;_e(e)&&(le(e.id,!0,e.ctrl),M()),e&&(e.cancelled=!0)};i.useEffect(()=>{u(K)},[K,u]),i.useEffect(()=>(window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),window.addEventListener("blur",M),()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),window.removeEventListener("blur",M)}),[]),i.useEffect(()=>{const e=n=>{K&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[K]);const se=e=>{if(b)return;M();const n=V.index+e;n<0||n>=V.entries.length||(re(V.entries[n]),ee({...V,index:n}))};i.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),se(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),i.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),y=document.createElement("canvas");y.width=64,y.height=64,y.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(C),64,64),0,0);let w,P=0;const R=O=>{if(O-P>40){P=O,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(y,0,0,512,512);const B=$?.68+.28*Math.sin(O/1e3*Math.PI):.85;for(let g=0;g<4096;g++)(!E[g]||!z[g])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(g%64*8,Math.floor(g/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let g=0;g<=64;g++)n.moveTo(g*8,0),n.lineTo(g*8,512),n.moveTo(0,g*8),n.lineTo(512,g*8);n.stroke();for(let g=0;g<4096;g++)E[g]&&z[g]&&te.current[g]===a&&(n.strokeStyle="#03140d",n.globalAlpha=B*.65,n.lineWidth=1.8,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.strokeStyle=f?.[te.current[g]]||"#19ff9d",n.globalAlpha=B,n.lineWidth=1,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.globalAlpha=1);T!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(T%64*8+1,Math.floor(T/64)*8+1,6,6))}w=requestAnimationFrame(R)};return w=requestAnimationFrame(R),()=>cancelAnimationFrame(w)},[C,E,z,$,T,f,a]);const ce=(e,n)=>{const y=e.currentTarget.getBoundingClientRect(),w=Math.floor((e.clientX-y.left)/y.width*64),P=Math.floor((e.clientY-y.top)/y.height*64);if(w<0||w>=64||P<0||P>=64)return;const R=P*64+w;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),le(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"每格只能属于一个类别,直接涂选即可替换原类别。旧 meat 标注默认归为裸露皮肤,已有细分类保留。未选格为非 meat;裸露皮肤、眼睛和嘴巴会自动汇总为 meat,眉毛和胡子仍属非 meat。"}),r.jsxs("p",{className:"meat-definition",children:["当前只高亮“",v,"”。完全被外层遮住的内层格已按正对正交投影排除(",t.occluded_count||0," 格)。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(be,{data:t,disabled:b,hint:"一次预选裸露皮肤、眼睛、嘴巴、眉毛和胡子,替换当前分类;可撤销,保存后才写入。",onStart:()=>{M(),m(!0)},onEnd:()=>m(!1),onApply:e=>{const n=Oe(j.current,e,E);re(n),ee(y=>{const w=[...y.entries.slice(0,y.index+1),n].slice(-60);return{entries:w,index:w.length-1}}),p({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),t.semantic.assistant_known_count>0&&r.jsxs("p",{className:"meat-warning",children:["其中 ",t.semantic.assistant_known_count," 格来自助手补标,尚未人工复核。修改格子会记录人工来源;切换类别仅改变高亮显示。"]}),r.jsxs("label",{className:"meat-help",children:[r.jsx("input",{type:"checkbox",checked:x,disabled:b,onChange:e=>k(e.target.checked)}),"本次已完整复核五类(含未选区域)"]}),r.jsx("p",{className:"meat-help",children:"勾选后保存,表示所有有效格已检查:未选格明确不属于这五类,可帮助模型识别衣饰和头发。还没检查完时保持不勾选,未细标格继续只参与 meat 二分类训练。"}),t.semantic.status==="needs_review"&&r.jsx("p",{className:"meat-warning",children:"旧分类与当前 meat 有冲突的格子已回退到当前二分类,请直接重新指定类别。"}),r.jsxs("label",{className:"semantic-category",children:["标注类别 ",r.jsx("select",{"aria-label":"标注类别",value:a,onChange:e=>{M(),l(Number(e.target.value))},children:d.map(e=>r.jsx("option",{value:e.id,children:e.label},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:d.map(e=>r.jsxs("button",{"aria-pressed":a===e.id,className:a===e.id?"active":"",style:{borderColor:e.color},onClick:()=>{M(),l(e.id)},children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:Y==="toggle"?"active":"",onClick:()=>S("toggle"),children:"点击切换选中"}),r.jsx("button",{className:Y==="erase"?"active":"",onClick:()=>S("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>A(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:D,onChange:e=>F(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:b||V.index===0,onClick:()=>se(-1),children:"撤销"}),r.jsx("button",{disabled:b||V.index===V.entries.length-1,onClick:()=>se(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:$,onChange:e=>ge(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:G===e?"active":"",onClick:()=>{Z(e),Q(y=>y+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=Re(e)},onPointerMoveCapture:e=>de(I.current,e),onPointerUpCapture:e=>de(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(Ee,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Xe,{data:t,rgba:C,mask:W,palette:f,layer:D,animate:$,view:G,viewEpoch:J,pickDown:ve,pickUp:xe,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:T===null?"透明区域不参与标注":`UV (${T%64}, ${Math.floor(T/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ce(e,!0),onPointerMove:e=>ce(e,!1),onPointerUp:M})]})]}),r.jsx("p",{className:"meat-help",children:"3D 和 UV 只用呼吸边框高亮当前类别,保留皮肤原色。点击其他类别的格子会改为当前类别;再次点击当前类别取消选择。Ctrl+点击泛洪选择近似颜色,阈值可调。擦除只影响当前类别,不会删除未高亮的其他类别。拖拽旋转不会标注,UV 可连续涂选。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:[v,":",ne.active," 格 · 共已分类 ",ne.selected," / ",ne.valid," 格",K?" · 未保存":"",r.jsxs("small",{children:["保存分类时同时更新 ",t.id,"_semantic.png 和兼容的 ",t.id,"_meat.png。"]})]}),r.jsx("button",{className:"button secondary",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!1,h,x)},children:"保存分类"}),r.jsx("button",{className:"button",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!0,h,x)},children:"保存并标注下一张"})]})]})}function ze({data:t,busy:s,onSave:o,onDirty:u}){return r.jsx(Fe,{data:t,busy:s,onSave:o,onDirty:u},`${t.key}-${t.meat_revision}-${t.semantic.semantic_revision}`)}export{ze as default}; diff --git a/best_annotator/static/assets/MeatEditor-CJ5AMr9l.js b/best_annotator/static/assets/MeatEditor-CJ5AMr9l.js new file mode 100644 index 0000000000000000000000000000000000000000..6647749a745fa192e4e21d65c65faad36794ce57 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-CJ5AMr9l.js @@ -0,0 +1,14 @@ +import{j as r,r as i,M as be}from"./index-Cch6ovWF.js";import{aA as ye,h as me,am as we,t as Me,u as q,ae as Ce,D as je,m as ue,aw as Ee,a0 as Se,a3 as ke,ay as Ae,aE as oe}from"./OrbitControls-fNwVPk9t.js";const Pe=["left","right","top","bottom","front","back"];function he(t,s){const[o,u,a]=t.size,l=t.inflate,d=new ye(o+l,u+l,a+l,o,u,a),f=d.toNonIndexed();d.dispose();const v=f.getAttribute("position"),c=f.getAttribute("uv"),m=[],h=[],p=[],x=[],k=[],b=new me;for(const E of f.groups){const[_,N,X,j,W,Y]=t.faces[Pe[E.materialIndex]];for(let S=E.start;S{u.array[f]=s[d]?1:0}),u.needsUpdate=!0;const a=t.getAttribute("meatColor"),l=new me;t.userData.vertexIds.forEach((d,f)=>{l.set(o?.[s[d]]||"#19ff9d"),a.setXYZ(f,l.r,l.g,l.b)}),a.needsUpdate=!0}function Ue(t,s){const o=Array.from({length:4096},()=>new Set);for(const u of t){const a=he(u,s),l=new Map,d=a.getAttribute("position"),f=a.userData.triangleIds,v=c=>[d.getX(c),d.getY(c),d.getZ(c)].map(m=>Math.round(m*1e4)).join(",");for(let c=0;cArray.from(u))}function Ie(t){const s=new Ce({vertexColors:!0,side:je});return s.onBeforeCompile=o=>{o.uniforms.meatPulse=t,o.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.vertexShader,o.vertexShader=o.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),o.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.fragmentShader,o.fragmentShader=o.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},s.customProgramCacheKey=()=>"meat-pulse-grid-v3",s}function De(t,s,o,u,a,l){if(!o[t]||!u[t])return[];const d=Math.max(0,Math.min(100,Number(l)||0)),f=new Uint8Array(4096),v=[t],c=[];for(f[t]=1;v.length;){const m=v.pop();if(!o[m]||!u[m])continue;let h=0;for(let p=0;p<3;p++)h+=(s[m*4+p]-s[t*4+p])**2;if(!(Math.sqrt(h/3)/255*100>d+1e-9)){c.push(m);for(const p of a[m])f[p]||(f[p]=1,v.push(p))}}return c}function Re(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function de(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function _e(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}function Te(t,s){return Uint8Array.from(t,o=>o===s?o:0)}function Ve(t,s,o,u){const a=t.slice();for(const l of s)(u!==0||a[l]===o)&&(a[l]=u);return a}function Le(t,s,o){const u=t.slice(),a=new Set(s);for(let l=0;l<4096;l++)o[l]?(u[l]===0||u[l]===1)&&(u[l]=a.has(l)?1:0):u[l]=0;return u}function Oe(t,s,o){if(!s.semantic_available)return Le(t,s.selected,o);const u=new Set([0,1,2,3,5,6]);if(!Array.isArray(s.labels)||s.labels.length!==4096||s.labels.some(d=>!Number.isInteger(d)||!u.has(d)))throw Error("模型细分类格式无效,未应用预选");const a=Uint8Array.from(s.labels,(d,f)=>o[f]?d:0),l=new Set(s.selected);if(a.some((d,f)=>!!(o[f]&&l.has(f))!==[1,2,3].includes(d)))throw Error("模型细分类与 meat 选区不一致,未应用预选");return a}const H=[0,-2,0];function Ye(t,s,o){const a={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[s];t.up.set(...s==="top"?[0,0,-1]:s==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...a.map((l,d)=>l+H[d])),t.lookAt(...H),o&&(o.target.set(...H),o.update()),t.updateMatrixWorld()}const fe=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0));function Be({part:t,rgba:s,mask:o,palette:u,pulse:a,pickDown:l,pickUp:d,hover:f}){const v=i.useMemo(()=>he(t,s),[t,s]),c=i.useMemo(()=>Ie(a),[a]);i.useEffect(()=>{Ne(v,o,u)},[v,o,u]),i.useEffect(()=>()=>{v.dispose(),c.dispose()},[v,c]);const m=(h,p)=>{h.stopPropagation();const x=v.userData.triangleIds[h.faceIndex];x!==void 0&&(f(x),p==="down"&&l(x),p==="up"&&d())};return r.jsx("mesh",{geometry:v,material:c,position:t.center,onPointerDown:h=>m(h,"down"),onPointerMove:h=>m(h,"hover"),onPointerUp:h=>m(h,"up")})}function Xe({data:t,rgba:s,mask:o,palette:u,layer:a,animate:l,view:d,viewEpoch:f,pickDown:v,pickUp:c,hover:m}){const h=i.useMemo(()=>({value:.85}),[]),p=i.useRef(),{camera:x,size:k}=Se();return ke(({clock:b})=>{h.value=l?.68+.28*Math.sin(b.elapsedTime*Math.PI):.85}),i.useEffect(()=>{Ye(x,d,p.current)},[d,f,x]),i.useEffect(()=>{x.zoom=Math.min(k.width/36,k.height/42),x.updateProjectionMatrix()},[x,k.width,k.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(b=>a==="both"||b.layer===(a==="inner"?0:1)).map(b=>r.jsx(Be,{part:b,rgba:s,mask:o,palette:u,pulse:h,pickDown:v,pickUp:c,hover:m},b.name+b.layer)),r.jsx(Ae,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:oe.ROTATE,MIDDLE:oe.DOLLY,RIGHT:oe.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:s,onSave:o,onDirty:u}){const[a,l]=i.useState(1),d=t.semantic?.classes||[],f=i.useMemo(()=>Object.fromEntries(d.map(e=>[e.id,e.color])),[t.semantic]),v=d.find(e=>e.id===a)?.label||"裸露皮肤",[c,m]=i.useState(!1),[h,p]=i.useState(null),[x,k]=i.useState(!1),b=s||c,C=i.useMemo(()=>fe(t.rgba),[t.rgba]),E=i.useMemo(()=>fe(t.valid),[t.valid]),_=i.useMemo(()=>Uint8Array.from(t.labels),[t]),[N,X]=i.useState(_),j=i.useRef(_),W=i.useMemo(()=>Te(N,a),[N,a]),[Y,S]=i.useState("toggle"),[D,F]=i.useState("both"),[G,Z]=i.useState("front"),[U,A]=i.useState(12),[J,Q]=i.useState(0),pe=i.useMemo(()=>Ue(t.parts,C),[t.parts,C]),[$,ge]=i.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[T,ae]=i.useState(null),[V,ee]=i.useState({entries:[_],index:0}),L=i.useRef(null),ie=i.useRef(null),te=i.useRef(N),I=i.useRef(null),ne=i.useMemo(()=>({selected:N.reduce((e,n)=>e+(n>0?1:0),0),active:N.reduce((e,n)=>e+(n===a?1:0),0),valid:E.reduce((e,n)=>e+n,0)}),[N,E,a]),K=x||N.some((e,n)=>e!==_[n]),z=i.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{D!=="both"&&n.layer!==(D==="inner"?0:1)||Object.values(n.faces).forEach(([y,w,P,R])=>{for(let O=w;O{j.current=e,te.current=e,X(e),k(!1)},M=()=>{L.current&&(j.current.some((e,n)=>e!==L.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),L.current=null)},le=(e,n=!1,y=!1)=>{if(b||!E[e]||!z[e]||(n&&(M(),L.current={before:j.current,value:Y==="erase"||j.current[e]===a?0:a,flood:y}),!L.current)||!n&&L.current.flood)return;const w=L.current.value,P=y&&n?De(e,C,E,z,pe,U):[e];P.every(R=>j.current[R]===w)||re(Ve(j.current,P,a,w))},ve=e=>{I.current&&(I.current.id=e)},xe=()=>{const e=I.current;_e(e)&&(le(e.id,!0,e.ctrl),M()),e&&(e.cancelled=!0)};i.useEffect(()=>{u(K)},[K,u]),i.useEffect(()=>(window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),window.addEventListener("blur",M),()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),window.removeEventListener("blur",M)}),[]),i.useEffect(()=>{const e=n=>{K&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[K]);const se=e=>{if(b)return;M();const n=V.index+e;n<0||n>=V.entries.length||(re(V.entries[n]),ee({...V,index:n}))};i.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),se(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),i.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),y=document.createElement("canvas");y.width=64,y.height=64,y.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(C),64,64),0,0);let w,P=0;const R=O=>{if(O-P>40){P=O,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(y,0,0,512,512);const B=$?.68+.28*Math.sin(O/1e3*Math.PI):.85;for(let g=0;g<4096;g++)(!E[g]||!z[g])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(g%64*8,Math.floor(g/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let g=0;g<=64;g++)n.moveTo(g*8,0),n.lineTo(g*8,512),n.moveTo(0,g*8),n.lineTo(512,g*8);n.stroke();for(let g=0;g<4096;g++)E[g]&&z[g]&&te.current[g]===a&&(n.strokeStyle="#03140d",n.globalAlpha=B*.65,n.lineWidth=1.8,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.strokeStyle=f?.[te.current[g]]||"#19ff9d",n.globalAlpha=B,n.lineWidth=1,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.globalAlpha=1);T!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(T%64*8+1,Math.floor(T/64)*8+1,6,6))}w=requestAnimationFrame(R)};return w=requestAnimationFrame(R),()=>cancelAnimationFrame(w)},[C,E,z,$,T,f,a]);const ce=(e,n)=>{const y=e.currentTarget.getBoundingClientRect(),w=Math.floor((e.clientX-y.left)/y.width*64),P=Math.floor((e.clientY-y.top)/y.height*64);if(w<0||w>=64||P<0||P>=64)return;const R=P*64+w;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),le(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"每格只能属于一个类别,直接涂选即可替换原类别。旧 meat 标注默认归为裸露皮肤,已有细分类保留。未选格为非 meat;裸露皮肤、眼睛和嘴巴会自动汇总为 meat,眉毛和胡子仍属非 meat。"}),r.jsxs("p",{className:"meat-definition",children:["当前只高亮“",v,"”。完全被外层遮住的内层格已按正对正交投影排除(",t.occluded_count||0," 格)。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(be,{data:t,disabled:b,hint:"一次预选裸露皮肤、眼睛、嘴巴、眉毛和胡子,替换当前分类;可撤销,保存后才写入。",onStart:()=>{M(),m(!0)},onEnd:()=>m(!1),onApply:e=>{const n=Oe(j.current,e,E);re(n),ee(y=>{const w=[...y.entries.slice(0,y.index+1),n].slice(-60);return{entries:w,index:w.length-1}}),p({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),t.semantic.assistant_known_count>0&&r.jsxs("p",{className:"meat-warning",children:["其中 ",t.semantic.assistant_known_count," 格来自助手补标,尚未人工复核。修改格子会记录人工来源;切换类别仅改变高亮显示。"]}),r.jsxs("label",{className:"meat-help",children:[r.jsx("input",{type:"checkbox",checked:x,disabled:b,onChange:e=>k(e.target.checked)}),"本次已完整复核五类(含未选区域)"]}),r.jsx("p",{className:"meat-help",children:"勾选后保存,表示所有有效格已检查:未选格明确不属于这五类,可帮助模型识别衣饰和头发。还没检查完时保持不勾选,未细标格继续只参与 meat 二分类训练。"}),t.semantic.status==="needs_review"&&r.jsx("p",{className:"meat-warning",children:"旧分类与当前 meat 有冲突的格子已回退到当前二分类,请直接重新指定类别。"}),r.jsxs("label",{className:"semantic-category",children:["标注类别 ",r.jsx("select",{"aria-label":"标注类别",value:a,onChange:e=>{M(),l(Number(e.target.value))},children:d.map(e=>r.jsx("option",{value:e.id,children:e.label},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:d.map(e=>r.jsxs("button",{"aria-pressed":a===e.id,className:a===e.id?"active":"",style:{borderColor:e.color},onClick:()=>{M(),l(e.id)},children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:Y==="toggle"?"active":"",onClick:()=>S("toggle"),children:"点击切换选中"}),r.jsx("button",{className:Y==="erase"?"active":"",onClick:()=>S("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>A(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:D,onChange:e=>F(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:b||V.index===0,onClick:()=>se(-1),children:"撤销"}),r.jsx("button",{disabled:b||V.index===V.entries.length-1,onClick:()=>se(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:$,onChange:e=>ge(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:G===e?"active":"",onClick:()=>{Z(e),Q(y=>y+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=Re(e)},onPointerMoveCapture:e=>de(I.current,e),onPointerUpCapture:e=>de(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(Ee,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Xe,{data:t,rgba:C,mask:W,palette:f,layer:D,animate:$,view:G,viewEpoch:J,pickDown:ve,pickUp:xe,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:T===null?"透明区域不参与标注":`UV (${T%64}, ${Math.floor(T/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ce(e,!0),onPointerMove:e=>ce(e,!1),onPointerUp:M})]})]}),r.jsx("p",{className:"meat-help",children:"3D 和 UV 只用呼吸边框高亮当前类别,保留皮肤原色。点击其他类别的格子会改为当前类别;再次点击当前类别取消选择。Ctrl+点击泛洪选择近似颜色,阈值可调。擦除只影响当前类别,不会删除未高亮的其他类别。拖拽旋转不会标注,UV 可连续涂选。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:[v,":",ne.active," 格 · 共已分类 ",ne.selected," / ",ne.valid," 格",K?" · 未保存":"",r.jsxs("small",{children:["保存分类时同时更新 ",t.id,"_semantic.png 和兼容的 ",t.id,"_meat.png。"]})]}),r.jsx("button",{className:"button secondary",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!1,h,x)},children:"保存分类"}),r.jsx("button",{className:"button",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!0,h,x)},children:"保存并标注下一张"})]})]})}function ze({data:t,busy:s,onSave:o,onDirty:u}){return r.jsx(Fe,{data:t,busy:s,onSave:o,onDirty:u},`${t.key}-${t.meat_revision}-${t.semantic.semantic_revision}`)}export{ze as default}; diff --git a/best_annotator/static/assets/MeatEditor-CqBAWHN1.js b/best_annotator/static/assets/MeatEditor-CqBAWHN1.js new file mode 100644 index 0000000000000000000000000000000000000000..20e17131e0c8f9d640471244d27cae6c2496b189 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-CqBAWHN1.js @@ -0,0 +1,5 @@ +import{r as i,j as r}from"./index-F-L6ur0r.js";import{aA as re,h as oe,am as se,t as ae,u as q,ae as ie,D as ce,aw as le,a0 as ue,a3 as fe,ay as de,aE as H}from"./OrbitControls-DCehNZC0.js";const me=["left","right","top","bottom","front","back"];function ee(t,s){const[c,m,d]=t.size,f=t.inflate,x=new re(c+f,m+f,d+f,c,m,d),u=x.toNonIndexed();x.dispose();const h=u.getAttribute("position"),o=u.getAttribute("uv"),a=[],p=[],l=[],g=[],N=new oe;for(const P of u.groups){const[X,K,Y,F,L,V]=t.faces[me[P.materialIndex]];for(let v=P.start;v{c.array[d]=s[m]?1:0}),c.needsUpdate=!0}function pe(t,s){const c=Array.from({length:4096},()=>new Set);for(const m of t){const d=ee(m,s),f=new Map,x=d.getAttribute("position"),u=d.userData.triangleIds,h=o=>[x.getX(o),x.getY(o),x.getZ(o)].map(a=>Math.round(a*1e4)).join(",");for(let o=0;oArray.from(m))}function ge(t){const s=new ie({vertexColors:!0,side:ce});return s.onBeforeCompile=c=>{c.uniforms.meatPulse=t,c.vertexShader=`attribute float meatSelected; varying float vMeatSelected; +`+c.vertexShader,c.vertexShader=c.vertexShader.replace("#include ",`#include +vMeatSelected = meatSelected;`),c.fragmentShader=`uniform float meatPulse; varying float vMeatSelected; +`+c.fragmentShader,c.fragmentShader=c.fragmentShader.replace("#include ",`#include +diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.04, 1.0, 0.46), vMeatSelected * meatPulse);`)},s.customProgramCacheKey=()=>"meat-pulse-v1",s}function ve(t,s,c,m,d,f){if(!c[t]||!m[t])return[];const x=Math.max(0,Math.min(100,Number(f)||0)),u=new Uint8Array(4096),h=[t],o=[];for(u[t]=1;h.length;){const a=h.pop();if(!c[a]||!m[a])continue;let p=0;for(let l=0;l<3;l++)p+=(s[a*4+l]-s[t*4+l])**2;if(!(Math.sqrt(p/3)/255*100>x+1e-9)){o.push(a);for(const l of d[a])u[l]||(u[l]=1,h.push(l))}}return o}function xe(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function J(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function be(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const Q=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0)),we=t=>{const s=new Uint8Array(4096);return t.forEach(c=>s[c]=1),s};function ye({part:t,rgba:s,mask:c,pulse:m,pickDown:d,pickUp:f,hover:x}){const u=i.useMemo(()=>ee(t,s),[t,s]),h=i.useMemo(()=>ge(m),[m]);i.useEffect(()=>{he(u,c)},[u,c]),i.useEffect(()=>()=>{u.dispose(),h.dispose()},[u,h]);const o=(a,p)=>{a.stopPropagation();const l=u.userData.triangleIds[a.faceIndex];l!==void 0&&(x(l),p==="down"&&d(l),p==="up"&&f())};return r.jsx("mesh",{geometry:u,material:h,position:t.center,onPointerDown:a=>o(a,"down"),onPointerMove:a=>o(a,"hover"),onPointerUp:a=>o(a,"up")})}function je({data:t,rgba:s,mask:c,layer:m,animate:d,view:f,viewEpoch:x,pickDown:u,pickUp:h,hover:o}){const a=i.useMemo(()=>({value:.6}),[]),p=i.useRef(),{camera:l}=ue();return fe(({clock:g})=>{a.value=d?.48+.28*Math.sin(g.elapsedTime*Math.PI):.6}),i.useEffect(()=>{const g={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,50,.01],bottom:[0,-52,.01]};l.position.set(...g[f]),l.lookAt(0,-2,0),p.current?.update()},[f,x,l]),r.jsxs(r.Fragment,{children:[t.parts.filter(g=>m==="both"||g.layer===(m==="inner"?0:1)).map(g=>r.jsx(ye,{part:g,rgba:s,mask:c,pulse:a,pickDown:u,pickUp:h,hover:o},g.name+g.layer)),r.jsx(de,{ref:p,target:[0,-2,0],enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:H.ROTATE,MIDDLE:H.DOLLY,RIGHT:H.ROTATE},minDistance:10,maxDistance:100})]})}function Se({data:t,busy:s,onSave:c,onDirty:m}){const d=i.useMemo(()=>Q(t.rgba),[t.rgba]),f=i.useMemo(()=>Q(t.valid),[t.valid]),x=i.useMemo(()=>we(t.selected),[t]),[u,h]=i.useState(x),o=i.useRef(x),[a,p]=i.useState("toggle"),[l,g]=i.useState("both"),[N,R]=i.useState("angle"),[P,X]=i.useState(12),[K,Y]=i.useState(0),F=i.useMemo(()=>pe(t.parts,d),[t.parts,d]),[L,V]=i.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[v,T]=i.useState(null),[M,G]=i.useState({entries:[x],index:0}),D=i.useRef(null),A=i.useRef(null),I=i.useRef(u),E=i.useRef(null),$=i.useMemo(()=>({selected:u.reduce((e,n)=>e+n,0),valid:f.reduce((e,n)=>e+n,0)}),[u,f]),U=u.some((e,n)=>e!==x[n]),O=i.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{l!=="both"&&n.layer!==(l==="inner"?0:1)||Object.values(n.faces).forEach(([b,y,C,k])=>{for(let S=y;S{o.current=e,I.current=e,h(e)},j=()=>{D.current&&(o.current.some((e,n)=>e!==D.current.before[n])&&G(e=>{const n=[...e.entries.slice(0,e.index+1),o.current].slice(-60);return{entries:n,index:n.length-1}}),D.current=null)},W=(e,n=!1,b=!1)=>{if(s||!f[e]||!O[e]||(n&&(j(),D.current={before:o.current,value:a==="erase"?0:1-o.current[e],flood:b}),!D.current)||!n&&D.current.flood)return;const y=D.current.value,C=b&&n?ve(e,d,f,O,F,P):[e];if(C.every(S=>o.current[S]===y))return;const k=o.current.slice();C.forEach(S=>k[S]=y),z(k)},te=e=>{E.current&&(E.current.id=e)},ne=()=>{const e=E.current;be(e)&&(W(e.id,!0,e.ctrl),j()),e&&(e.cancelled=!0)};i.useEffect(()=>{m(U)},[U,m]),i.useEffect(()=>(window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),window.addEventListener("blur",j),()=>{window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",j)}),[]),i.useEffect(()=>{const e=n=>{U&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[U]);const _=e=>{if(s)return;j();const n=M.index+e;n<0||n>=M.entries.length||(z(M.entries[n]),G({...M,index:n}))};i.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),_(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),i.useEffect(()=>{const e=A.current,n=e.getContext("2d"),b=document.createElement("canvas");b.width=64,b.height=64,b.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(d),64,64),0,0);let y,C=0;const k=S=>{if(S-C>40){C=S,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(b,0,0,512,512);const B=L?.48+.28*Math.sin(S/1e3*Math.PI):.6;for(let w=0;w<4096;w++)!f[w]||!O[w]?(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(w%64*8,Math.floor(w/64)*8,8,8)):I.current[w]&&(n.fillStyle=`rgba(25,255,157,${B})`,n.fillRect(w%64*8,Math.floor(w/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let w=0;w<=64;w++)n.moveTo(w*8,0),n.lineTo(w*8,512),n.moveTo(0,w*8),n.lineTo(512,w*8);n.stroke(),v!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(v%64*8+1,Math.floor(v/64)*8+1,6,6))}y=requestAnimationFrame(k)};return y=requestAnimationFrame(k),()=>cancelAnimationFrame(y)},[d,f,O,L,v]);const Z=(e,n)=>{const b=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-b.left)/b.width*64),C=Math.floor((e.clientY-b.top)/b.height*64);if(y<0||y>=64||C<0||C>=64)return;const k=C*64+y;T(k),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),W(k,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。"}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:a==="toggle"?"active":"",onClick:()=>p("toggle"),children:"点击切换选中"}),r.jsx("button",{className:a==="erase"?"active":"",onClick:()=>p("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:P,onChange:e=>X(Number(e.target.value))}),r.jsxs("output",{children:[P,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:l,onChange:e=>g(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:s||M.index===0,onClick:()=>_(-1),children:"撤销"}),r.jsx("button",{disabled:s||M.index===M.entries.length-1,onClick:()=>_(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:L,onChange:e=>V(e.target.checked)}),"呼吸高亮"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"拖拽旋转 · 点击切换 · Ctrl+点击泛洪 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({angle:"斜视",front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部"}).map(([e,n])=>r.jsx("button",{className:N===e?"active":"",onClick:()=>{R(e),Y(b=>b+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?E.current&&(E.current.cancelled=!0):E.current=xe(e)},onPointerMoveCapture:e=>J(E.current,e),onPointerUpCapture:e=>J(E.current,e),onPointerCancelCapture:()=>{E.current&&(E.current.cancelled=!0)},children:r.jsx(le,{camera:{position:[30,22,38],fov:43},children:r.jsx(je,{data:t,rgba:d,mask:u,layer:l,animate:L,view:N,viewEpoch:K,pickDown:te,pickUp:ne,hover:T})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:v===null?"可标注被遮住的表面":`UV (${v%64}, ${Math.floor(v/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:A,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>Z(e,!0),onPointerMove:e=>Z(e,!1),onPointerUp:j})]})]}),r.jsx("p",{className:"meat-help",children:"Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",$.selected," / ",$.valid," 格",U?" · 未保存":"",r.jsxs("small",{children:["保存为 ",t.id,"_meat.png;未选择的有效格为非 meat。"]})]}),r.jsx("button",{className:"button secondary",disabled:s,onClick:()=>{j(),c(Array.from(o.current.keys()).filter(e=>o.current[e]),!1)},children:"保存 meat"}),r.jsx("button",{className:"button",disabled:s,onClick:()=>{j(),c(Array.from(o.current.keys()).filter(e=>o.current[e]),!0)},children:"保存并标注下一张"})]})]})}export{Se as default}; diff --git a/best_annotator/static/assets/MeatEditor-DKH6Jdjh.js b/best_annotator/static/assets/MeatEditor-DKH6Jdjh.js new file mode 100644 index 0000000000000000000000000000000000000000..41628fab7c6c596829118e0677d2d31ada1e76e9 --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-DKH6Jdjh.js @@ -0,0 +1,14 @@ +import{j as r,r as i,M as be}from"./index-FsJherd9.js";import{aA as ye,h as me,am as we,t as Me,u as q,ae as Ce,D as je,m as ue,aw as Ee,a0 as Se,a3 as ke,ay as Ae,aE as oe}from"./OrbitControls-DWROePHL.js";const Pe=["left","right","top","bottom","front","back"];function he(t,s){const[o,u,a]=t.size,l=t.inflate,d=new ye(o+l,u+l,a+l,o,u,a),f=d.toNonIndexed();d.dispose();const v=f.getAttribute("position"),c=f.getAttribute("uv"),m=[],h=[],p=[],x=[],k=[],b=new me;for(const E of f.groups){const[_,N,X,j,W,Y]=t.faces[Pe[E.materialIndex]];for(let S=E.start;S{u.array[f]=s[d]?1:0}),u.needsUpdate=!0;const a=t.getAttribute("meatColor"),l=new me;t.userData.vertexIds.forEach((d,f)=>{l.set(o?.[s[d]]||"#19ff9d"),a.setXYZ(f,l.r,l.g,l.b)}),a.needsUpdate=!0}function Ue(t,s){const o=Array.from({length:4096},()=>new Set);for(const u of t){const a=he(u,s),l=new Map,d=a.getAttribute("position"),f=a.userData.triangleIds,v=c=>[d.getX(c),d.getY(c),d.getZ(c)].map(m=>Math.round(m*1e4)).join(",");for(let c=0;cArray.from(u))}function Ie(t){const s=new Ce({vertexColors:!0,side:je});return s.onBeforeCompile=o=>{o.uniforms.meatPulse=t,o.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.vertexShader,o.vertexShader=o.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),o.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+o.fragmentShader,o.fragmentShader=o.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},s.customProgramCacheKey=()=>"meat-pulse-grid-v3",s}function De(t,s,o,u,a,l){if(!o[t]||!u[t])return[];const d=Math.max(0,Math.min(100,Number(l)||0)),f=new Uint8Array(4096),v=[t],c=[];for(f[t]=1;v.length;){const m=v.pop();if(!o[m]||!u[m])continue;let h=0;for(let p=0;p<3;p++)h+=(s[m*4+p]-s[t*4+p])**2;if(!(Math.sqrt(h/3)/255*100>d+1e-9)){c.push(m);for(const p of a[m])f[p]||(f[p]=1,v.push(p))}}return c}function Re(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function de(t,s){t&&t.pointerId===s.pointerId&&Math.hypot(s.clientX-t.x,s.clientY-t.y)>5&&(t.dragged=!0)}function _e(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}function Te(t,s){return Uint8Array.from(t,o=>o===s?o:0)}function Ve(t,s,o,u){const a=t.slice();for(const l of s)(u!==0||a[l]===o)&&(a[l]=u);return a}function Le(t,s,o){const u=t.slice(),a=new Set(s);for(let l=0;l<4096;l++)o[l]?(u[l]===0||u[l]===1)&&(u[l]=a.has(l)?1:0):u[l]=0;return u}function Oe(t,s,o){if(!s.semantic_available)return Le(t,s.selected,o);const u=new Set([0,1,2,3,5,6]);if(!Array.isArray(s.labels)||s.labels.length!==4096||s.labels.some(d=>!Number.isInteger(d)||!u.has(d)))throw Error("模型细分类格式无效,未应用预选");const a=Uint8Array.from(s.labels,(d,f)=>o[f]?d:0),l=new Set(s.selected);if(a.some((d,f)=>!!(o[f]&&l.has(f))!==[1,2,3].includes(d)))throw Error("模型细分类与 meat 选区不一致,未应用预选");return a}const H=[0,-2,0];function Ye(t,s,o){const a={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[s];t.up.set(...s==="top"?[0,0,-1]:s==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...a.map((l,d)=>l+H[d])),t.lookAt(...H),o&&(o.target.set(...H),o.update()),t.updateMatrixWorld()}const fe=t=>Uint8Array.from(atob(t),s=>s.charCodeAt(0));function Be({part:t,rgba:s,mask:o,palette:u,pulse:a,pickDown:l,pickUp:d,hover:f}){const v=i.useMemo(()=>he(t,s),[t,s]),c=i.useMemo(()=>Ie(a),[a]);i.useEffect(()=>{Ne(v,o,u)},[v,o,u]),i.useEffect(()=>()=>{v.dispose(),c.dispose()},[v,c]);const m=(h,p)=>{h.stopPropagation();const x=v.userData.triangleIds[h.faceIndex];x!==void 0&&(f(x),p==="down"&&l(x),p==="up"&&d())};return r.jsx("mesh",{geometry:v,material:c,position:t.center,onPointerDown:h=>m(h,"down"),onPointerMove:h=>m(h,"hover"),onPointerUp:h=>m(h,"up")})}function Xe({data:t,rgba:s,mask:o,palette:u,layer:a,animate:l,view:d,viewEpoch:f,pickDown:v,pickUp:c,hover:m}){const h=i.useMemo(()=>({value:.85}),[]),p=i.useRef(),{camera:x,size:k}=Se();return ke(({clock:b})=>{h.value=l?.68+.28*Math.sin(b.elapsedTime*Math.PI):.85}),i.useEffect(()=>{Ye(x,d,p.current)},[d,f,x]),i.useEffect(()=>{x.zoom=Math.min(k.width/36,k.height/42),x.updateProjectionMatrix()},[x,k.width,k.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(b=>a==="both"||b.layer===(a==="inner"?0:1)).map(b=>r.jsx(Be,{part:b,rgba:s,mask:o,palette:u,pulse:h,pickDown:v,pickUp:c,hover:m},b.name+b.layer)),r.jsx(Ae,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:oe.ROTATE,MIDDLE:oe.DOLLY,RIGHT:oe.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:s,onSave:o,onDirty:u}){const[a,l]=i.useState(1),d=t.semantic?.classes||[],f=i.useMemo(()=>Object.fromEntries(d.map(e=>[e.id,e.color])),[t.semantic]),v=d.find(e=>e.id===a)?.label||"裸露皮肤",[c,m]=i.useState(!1),[h,p]=i.useState(null),[x,k]=i.useState(!1),b=s||c,C=i.useMemo(()=>fe(t.rgba),[t.rgba]),E=i.useMemo(()=>fe(t.valid),[t.valid]),_=i.useMemo(()=>Uint8Array.from(t.labels),[t]),[N,X]=i.useState(_),j=i.useRef(_),W=i.useMemo(()=>Te(N,a),[N,a]),[Y,S]=i.useState("toggle"),[D,F]=i.useState("both"),[G,Z]=i.useState("front"),[U,A]=i.useState(12),[J,Q]=i.useState(0),pe=i.useMemo(()=>Ue(t.parts,C),[t.parts,C]),[$,ge]=i.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[T,ae]=i.useState(null),[V,ee]=i.useState({entries:[_],index:0}),L=i.useRef(null),ie=i.useRef(null),te=i.useRef(N),I=i.useRef(null),ne=i.useMemo(()=>({selected:N.reduce((e,n)=>e+(n>0?1:0),0),active:N.reduce((e,n)=>e+(n===a?1:0),0),valid:E.reduce((e,n)=>e+n,0)}),[N,E,a]),K=x||N.some((e,n)=>e!==_[n]),z=i.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{D!=="both"&&n.layer!==(D==="inner"?0:1)||Object.values(n.faces).forEach(([y,w,P,R])=>{for(let O=w;O{j.current=e,te.current=e,X(e),k(!1)},M=()=>{L.current&&(j.current.some((e,n)=>e!==L.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),L.current=null)},le=(e,n=!1,y=!1)=>{if(b||!E[e]||!z[e]||(n&&(M(),L.current={before:j.current,value:Y==="erase"||j.current[e]===a?0:a,flood:y}),!L.current)||!n&&L.current.flood)return;const w=L.current.value,P=y&&n?De(e,C,E,z,pe,U):[e];P.every(R=>j.current[R]===w)||re(Ve(j.current,P,a,w))},ve=e=>{I.current&&(I.current.id=e)},xe=()=>{const e=I.current;_e(e)&&(le(e.id,!0,e.ctrl),M()),e&&(e.cancelled=!0)};i.useEffect(()=>{u(K)},[K,u]),i.useEffect(()=>(window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),window.addEventListener("blur",M),()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),window.removeEventListener("blur",M)}),[]),i.useEffect(()=>{const e=n=>{K&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[K]);const se=e=>{if(b)return;M();const n=V.index+e;n<0||n>=V.entries.length||(re(V.entries[n]),ee({...V,index:n}))};i.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),se(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),i.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),y=document.createElement("canvas");y.width=64,y.height=64,y.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(C),64,64),0,0);let w,P=0;const R=O=>{if(O-P>40){P=O,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(y,0,0,512,512);const B=$?.68+.28*Math.sin(O/1e3*Math.PI):.85;for(let g=0;g<4096;g++)(!E[g]||!z[g])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(g%64*8,Math.floor(g/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let g=0;g<=64;g++)n.moveTo(g*8,0),n.lineTo(g*8,512),n.moveTo(0,g*8),n.lineTo(512,g*8);n.stroke();for(let g=0;g<4096;g++)E[g]&&z[g]&&te.current[g]===a&&(n.strokeStyle="#03140d",n.globalAlpha=B*.65,n.lineWidth=1.8,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.strokeStyle=f?.[te.current[g]]||"#19ff9d",n.globalAlpha=B,n.lineWidth=1,n.strokeRect(g%64*8+.5,Math.floor(g/64)*8+.5,7,7),n.globalAlpha=1);T!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(T%64*8+1,Math.floor(T/64)*8+1,6,6))}w=requestAnimationFrame(R)};return w=requestAnimationFrame(R),()=>cancelAnimationFrame(w)},[C,E,z,$,T,f,a]);const ce=(e,n)=>{const y=e.currentTarget.getBoundingClientRect(),w=Math.floor((e.clientX-y.left)/y.width*64),P=Math.floor((e.clientY-y.top)/y.height*64);if(w<0||w>=64||P<0||P>=64)return;const R=P*64+w;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),le(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsx("p",{className:"meat-definition",children:"每格只能属于一个类别,直接涂选即可替换原类别。旧 meat 标注默认归为裸露皮肤,已有细分类保留。未选格为非 meat;裸露皮肤、眼睛和嘴巴会自动汇总为 meat,眉毛和胡子仍属非 meat。"}),r.jsxs("p",{className:"meat-definition",children:["当前只高亮“",v,"”。完全被外层遮住的内层格已按正对正交投影排除(",t.occluded_count||0," 格)。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),r.jsx(be,{data:t,disabled:b,hint:"一次预选裸露皮肤、眼睛、嘴巴、眉毛和胡子,替换当前分类;可撤销,保存后才写入。",onStart:()=>{M(),m(!0)},onEnd:()=>m(!1),onApply:e=>{const n=Oe(j.current,e,E);re(n),ee(y=>{const w=[...y.entries.slice(0,y.index+1),n].slice(-60);return{entries:w,index:w.length-1}}),p({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),t.semantic.assistant_known_count>0&&r.jsxs("p",{className:"meat-warning",children:["其中 ",t.semantic.assistant_known_count," 格来自助手补标,尚未人工复核。修改格子会记录人工来源;切换类别仅改变高亮显示。"]}),r.jsxs("label",{className:"meat-help",children:[r.jsx("input",{type:"checkbox",checked:x,disabled:b,onChange:e=>k(e.target.checked)}),"本次已完整复核五类(含未选区域)"]}),r.jsx("p",{className:"meat-help",children:"勾选后保存,表示所有有效格已检查:未选格明确不属于这五类,可帮助模型识别衣饰和头发。还没检查完时保持不勾选,未细标格继续只参与 meat 二分类训练。"}),t.semantic.status==="needs_review"&&r.jsx("p",{className:"meat-warning",children:"旧分类与当前 meat 有冲突的格子已回退到当前二分类,请直接重新指定类别。"}),r.jsxs("label",{className:"semantic-category",children:["标注类别 ",r.jsx("select",{"aria-label":"标注类别",value:a,onChange:e=>{M(),l(Number(e.target.value))},children:d.map(e=>r.jsx("option",{value:e.id,children:e.label},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:d.map(e=>r.jsxs("button",{"aria-pressed":a===e.id,className:a===e.id?"active":"",style:{borderColor:e.color},onClick:()=>{M(),l(e.id)},children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:Y==="toggle"?"active":"",onClick:()=>S("toggle"),children:"点击切换选中"}),r.jsx("button",{className:Y==="erase"?"active":"",onClick:()=>S("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>A(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:D,onChange:e=>F(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:b||V.index===0,onClick:()=>se(-1),children:"撤销"}),r.jsx("button",{disabled:b||V.index===V.entries.length-1,onClick:()=>se(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:$,onChange:e=>ge(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:G===e?"active":"",onClick:()=>{Z(e),Q(y=>y+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=Re(e)},onPointerMoveCapture:e=>de(I.current,e),onPointerUpCapture:e=>de(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(Ee,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Xe,{data:t,rgba:C,mask:W,palette:f,layer:D,animate:$,view:G,viewEpoch:J,pickDown:ve,pickUp:xe,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:T===null?"透明区域不参与标注":`UV (${T%64}, ${Math.floor(T/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ce(e,!0),onPointerMove:e=>ce(e,!1),onPointerUp:M})]})]}),r.jsx("p",{className:"meat-help",children:"3D 和 UV 只用呼吸边框高亮当前类别,保留皮肤原色。点击其他类别的格子会改为当前类别;再次点击当前类别取消选择。Ctrl+点击泛洪选择近似颜色,阈值可调。擦除只影响当前类别,不会删除未高亮的其他类别。拖拽旋转不会标注,UV 可连续涂选。"}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:[v,":",ne.active," 格 · 共已分类 ",ne.selected," / ",ne.valid," 格",K?" · 未保存":"",r.jsxs("small",{children:["保存分类时同时更新 ",t.id,"_semantic.png 和兼容的 ",t.id,"_meat.png。"]})]}),r.jsx("button",{className:"button secondary",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!1,h,x)},children:"保存分类"}),r.jsx("button",{className:"button",disabled:b,onClick:()=>{M(),o(Array.from(j.current),!0,h,x)},children:"保存并标注下一张"})]})]})}function ze({data:t,busy:s,onSave:o,onDirty:u}){return r.jsx(Fe,{data:t,busy:s,onSave:o,onDirty:u},`${t.key}-${t.meat_revision}-${t.semantic.semantic_revision}`)}export{ze as default}; diff --git a/best_annotator/static/assets/MeatEditor-WUbpTXnd.js b/best_annotator/static/assets/MeatEditor-WUbpTXnd.js new file mode 100644 index 0000000000000000000000000000000000000000..f7dc83d93f8a7900932349226b23067e7aeb26cf --- /dev/null +++ b/best_annotator/static/assets/MeatEditor-WUbpTXnd.js @@ -0,0 +1,14 @@ +import{r as s,R as ye,j as r,M as Me}from"./index-D4HloxTJ.js";import{aA as je,h as he,am as we,t as Ce,u as q,ae as Ee,D as Se,m as de,aw as ke,a0 as Ae,a3 as Pe,ay as Ne,aE as se}from"./OrbitControls-JGGzURQK.js";const Ue=["left","right","top","bottom","front","back"];function ge(t,o){const[l,v,i]=t.size,c=t.inflate,m=new je(l+c,v+c,i+c,l,v,i),f=m.toNonIndexed();m.dispose();const h=f.getAttribute("position"),a=f.getAttribute("uv"),d=[],g=[],p=[],b=[],S=[],w=new he;for(const A of f.groups){const[N,L,T,B,j,X]=t.faces[Ue[A.materialIndex]];for(let C=A.start;C{v.array[f]=o[m]?1:0}),v.needsUpdate=!0;const i=t.getAttribute("meatColor"),c=new he;t.userData.vertexIds.forEach((m,f)=>{c.set(l?.[o[m]]||"#19ff9d"),i.setXYZ(f,c.r,c.g,c.b)}),i.needsUpdate=!0}function Re(t,o){const l=Array.from({length:4096},()=>new Set);for(const v of t){const i=ge(v,o),c=new Map,m=i.getAttribute("position"),f=i.userData.triangleIds,h=a=>[m.getX(a),m.getY(a),m.getZ(a)].map(d=>Math.round(d*1e4)).join(",");for(let a=0;aArray.from(v))}function De(t){const o=new Ee({vertexColors:!0,side:Se});return o.onBeforeCompile=l=>{l.uniforms.meatPulse=t,l.vertexShader=`attribute vec3 meatColor; varying vec3 vMeatColor; attribute float meatSelected; attribute vec2 meatCellUV; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.vertexShader,l.vertexShader=l.vertexShader.replace("#include ",`#include +vMeatColor = meatColor; vMeatSelected = meatSelected; vMeatCellUV = meatCellUV;`),l.fragmentShader=`varying vec3 vMeatColor; uniform float meatPulse; varying float vMeatSelected; varying vec2 vMeatCellUV; +`+l.fragmentShader,l.fragmentShader=l.fragmentShader.replace("#include ",`#include + vec2 cellEdge = min(vMeatCellUV, 1.0 - vMeatCellUV); + vec2 edgePixels = cellEdge / max(fwidth(vMeatCellUV), vec2(0.00001)); + float distanceToEdge = min(edgePixels.x, edgePixels.y); + // Keep the middle of every cell untouched, even when zoomed far out. + float borderOnly = 1.0 - smoothstep(0.12, 0.22, min(cellEdge.x, cellEdge.y)); + float outline = (1.0 - smoothstep(0.65, 1.35, distanceToEdge)) * borderOnly; + float backing = (1.0 - smoothstep(1.25, 2.1, distanceToEdge)) * borderOnly; + diffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.008, 0.04, 0.025), vMeatSelected * backing * meatPulse * 0.65); + diffuseColor.rgb = mix(diffuseColor.rgb, vMeatColor, vMeatSelected * outline * meatPulse); + `)},o.customProgramCacheKey=()=>"meat-pulse-grid-v3",o}function Te(t,o,l,v,i,c){if(!l[t]||!v[t])return[];const m=Math.max(0,Math.min(100,Number(c)||0)),f=new Uint8Array(4096),h=[t],a=[];for(f[t]=1;h.length;){const d=h.pop();if(!l[d]||!v[d])continue;let g=0;for(let p=0;p<3;p++)g+=(o[d*4+p]-o[t*4+p])**2;if(!(Math.sqrt(g/3)/255*100>m+1e-9)){a.push(d);for(const p of i[d])f[p]||(f[p]=1,h.push(p))}}return a}function _e(t){return{pointerId:t.pointerId,x:t.clientX,y:t.clientY,ctrl:t.ctrlKey,button:t.button,dragged:!1,cancelled:!t.isPrimary&&t.isPrimary!==void 0}}function fe(t,o){t&&t.pointerId===o.pointerId&&Math.hypot(o.clientX-t.x,o.clientY-t.y)>5&&(t.dragged=!0)}function Ve(t){return!!t&&!t.dragged&&!t.cancelled&&(t.button===0||t.button===2&&t.ctrl)&&Number.isInteger(t.id)}const H=[0,-2,0];function Le(t,o,l){const i={angle:[30,22,38],front:[0,0,48],back:[0,0,-48],left:[48,0,0],right:[-48,0,0],top:[0,48,0],bottom:[0,-48,0]}[o];t.up.set(...o==="top"?[0,0,-1]:o==="bottom"?[0,0,1]:[0,1,0]),t.position.set(...i.map((c,m)=>c+H[m])),t.lookAt(...H),l&&(l.target.set(...H),l.update()),t.updateMatrixWorld()}const me=t=>Uint8Array.from(atob(t),o=>o.charCodeAt(0)),oe=t=>{const o=new Uint8Array(4096);return t.forEach(l=>o[l]=1),o};function Oe({part:t,rgba:o,mask:l,palette:v,pulse:i,pickDown:c,pickUp:m,hover:f}){const h=s.useMemo(()=>ge(t,o),[t,o]),a=s.useMemo(()=>De(i),[i]);s.useEffect(()=>{Ie(h,l,v)},[h,l,v]),s.useEffect(()=>()=>{h.dispose(),a.dispose()},[h,a]);const d=(g,p)=>{g.stopPropagation();const b=h.userData.triangleIds[g.faceIndex];b!==void 0&&(f(b),p==="down"&&c(b),p==="up"&&m())};return r.jsx("mesh",{geometry:h,material:a,position:t.center,onPointerDown:g=>d(g,"down"),onPointerMove:g=>d(g,"hover"),onPointerUp:g=>d(g,"up")})}function Ye({data:t,rgba:o,mask:l,palette:v,layer:i,animate:c,view:m,viewEpoch:f,pickDown:h,pickUp:a,hover:d}){const g=s.useMemo(()=>({value:.85}),[]),p=s.useRef(),{camera:b,size:S}=Ae();return Pe(({clock:w})=>{g.value=c?.68+.28*Math.sin(w.elapsedTime*Math.PI):.85}),s.useEffect(()=>{Le(b,m,p.current)},[m,f,b]),s.useEffect(()=>{b.zoom=Math.min(S.width/36,S.height/42),b.updateProjectionMatrix()},[b,S.width,S.height]),r.jsxs(r.Fragment,{children:[t.parts.filter(w=>i==="both"||w.layer===(i==="inner"?0:1)).map(w=>r.jsx(Oe,{part:w,rgba:o,mask:l,palette:v,pulse:g,pickDown:h,pickUp:a,hover:d},w.name+w.layer)),r.jsx(Ne,{ref:p,target:H,enablePan:!1,enableDamping:!1,mouseButtons:{LEFT:se.ROTATE,MIDDLE:se.DOLLY,RIGHT:se.ROTATE},minZoom:2,maxZoom:100})]})}function Fe({data:t,busy:o,onSave:l,onDirty:v,semantic:i=!1}){const[c,m]=s.useState(2),[f,h]=s.useState(""),a=t.semantic?.classes||[],d=s.useMemo(()=>i?Object.fromEntries(a.map(e=>[e.id,e.color])):void 0,[i,t.semantic]),g=s.useMemo(()=>oe(t.selected),[t.selected]),[p,b]=s.useState(!1),[S,w]=s.useState(null),M=o||p||i&&!t.semantic?.available,A=s.useMemo(()=>me(t.rgba),[t.rgba]),N=s.useMemo(()=>me(t.valid),[t.valid]),L=s.useMemo(()=>i?Uint8Array.from(t.semantic.labels):oe(t.selected),[t,i]),[T,B]=s.useState(L),j=s.useRef(L),[X,C]=s.useState("toggle"),[_,G]=s.useState("both"),[K,W]=s.useState("front"),[U,P]=s.useState(12),[J,Q]=s.useState(0),pe=s.useMemo(()=>Re(t.parts,A),[t.parts,A]),[Z,ve]=s.useState(!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches),[O,ae]=s.useState(null),[Y,ee]=s.useState({entries:[L],index:0}),F=s.useRef(null),ie=s.useRef(null),te=s.useRef(T),I=s.useRef(null),le=s.useMemo(()=>({selected:T.reduce((e,n)=>e+(n>0?1:0),0),valid:N.reduce((e,n)=>e+n,0)}),[T,N]),z=T.some((e,n)=>e!==L[n]),$=s.useMemo(()=>{const e=new Uint8Array(4096);return t.parts.forEach(n=>{_!=="both"&&n.layer!==(_==="inner"?0:1)||Object.values(n.faces).forEach(([x,y,k,R])=>{for(let D=y;D{j.current=e,te.current=e,B(e)},E=()=>{F.current&&(j.current.some((e,n)=>e!==F.current.before[n])&&ee(e=>{const n=[...e.entries.slice(0,e.index+1),j.current].slice(-60);return{entries:n,index:n.length-1}}),F.current=null)},ce=(e,n=!1,x=!1)=>{if(M||!N[e]||!$[e]||(n&&(E(),F.current={before:j.current,value:X==="erase"||j.current[e]===(i?c:1)?0:i?c:1,flood:x}),!F.current)||!n&&F.current.flood)return;const y=F.current.value,k=x&&n?Te(e,A,N,$,pe,U):[e];if(k.every(u=>j.current[u]===y))return;const R=i&&y?a.find(u=>u.id===y).meat:null,D=k.filter(u=>R===null||!!g[u]===R);h(D.lengthV[u]=y),ne(V)},xe=e=>{I.current&&(I.current.id=e)},be=()=>{const e=I.current;Ve(e)&&(ce(e.id,!0,e.ctrl),E()),e&&(e.cancelled=!0)};s.useEffect(()=>{v(z)},[z,v]),s.useEffect(()=>(window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",E),()=>{window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",E)}),[]),s.useEffect(()=>{const e=n=>{z&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[z]);const re=e=>{if(M)return;E();const n=Y.index+e;n<0||n>=Y.entries.length||(ne(Y.entries[n]),ee({...Y,index:n}))};s.useEffect(()=>{const e=n=>{(n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="z"&&(n.preventDefault(),re(n.shiftKey?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),s.useEffect(()=>{const e=ie.current,n=e.getContext("2d"),x=document.createElement("canvas");x.width=64,x.height=64,x.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(A),64,64),0,0);let y,k=0;const R=D=>{if(D-k>40){k=D,n.clearRect(0,0,512,512),n.imageSmoothingEnabled=!1,n.drawImage(x,0,0,512,512);const V=Z?.68+.28*Math.sin(D/1e3*Math.PI):.85;for(let u=0;u<4096;u++)(!N[u]||!$[u])&&(n.fillStyle="rgba(27,33,44,.72)",n.fillRect(u%64*8,Math.floor(u/64)*8,8,8));n.strokeStyle="rgba(0,0,0,.18)",n.lineWidth=.5,n.beginPath();for(let u=0;u<=64;u++)n.moveTo(u*8,0),n.lineTo(u*8,512),n.moveTo(0,u*8),n.lineTo(512,u*8);n.stroke();for(let u=0;u<4096;u++)N[u]&&$[u]&&te.current[u]&&(n.strokeStyle="#03140d",n.globalAlpha=V*.65,n.lineWidth=1.8,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.strokeStyle=d?.[te.current[u]]||"#19ff9d",n.globalAlpha=V,n.lineWidth=1,n.strokeRect(u%64*8+.5,Math.floor(u/64)*8+.5,7,7),n.globalAlpha=1);O!==null&&(n.strokeStyle="#fff",n.lineWidth=2,n.strokeRect(O%64*8+1,Math.floor(O/64)*8+1,6,6))}y=requestAnimationFrame(R)};return y=requestAnimationFrame(R),()=>cancelAnimationFrame(y)},[A,N,$,Z,O,d]);const ue=(e,n)=>{const x=e.currentTarget.getBoundingClientRect(),y=Math.floor((e.clientX-x.left)/x.width*64),k=Math.floor((e.clientY-x.top)/x.height*64);if(y<0||y>=64||k<0||k>=64)return;const R=k*64+y;ae(R),(e.buttons===1||n&&e.ctrlKey&&e.button===2)&&(n&&e.currentTarget.setPointerCapture(e.pointerId),ce(R,n,e.ctrlKey))};return r.jsxs("div",{className:"meat-editor",children:[r.jsxs("p",{className:"meat-definition",children:["meat:脸、眼睛、嘴巴和裸露身体。头发、胡须、眼镜、帽子、衣物和饰品不选。内外层分别标注。按各个面正对的正交投影,完全被外层遮住的内层格已透明排除(",t.occluded_count||0," 格);斜视时露出不改变此规则。"]}),t.meat_status==="stale"&&r.jsx("p",{className:"meat-warning",children:"perfect 皮肤已变化,本次从空白标注开始;旧标注会在保存时归档。"}),!i&&r.jsx(Me,{data:t,disabled:M,onStart:()=>{E(),b(!0)},onEnd:()=>b(!1),onApply:e=>{const n=oe(e.selected);ne(n),ee(x=>{const y=[...x.entries.slice(0,x.index+1),n].slice(-60);return{entries:y,index:y.length-1}}),w({model_id:e.model_id,checkpoint_sha256:e.checkpoint_sha256})}}),i&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"meat-definition",children:"细分类可只标容易混淆的格子,未细标格为“未知”,仍保留原 meat 标签参与二分类训练。细分类只包含裸露皮肤、眼睛、嘴巴、眉毛、胡子;头发、眼镜、衣饰不单独细分,仍属于非 meat。"}),t.semantic.assistant_known_count>0&&r.jsxs("p",{className:"meat-warning",children:["其中 ",t.semantic.assistant_known_count," 格为助手补标,尚未人工复核,训练时按较低权重使用。修改的格子会记为人工标注。疑似眉毛或帽徽与原 meat 冲突的格子暂留未知;原二分类未更改。"]}),!t.semantic.available&&r.jsx("p",{className:"meat-warning",children:"请先保存 meat 二分类,再补细分类。"}),t.semantic.status==="needs_review"&&r.jsxs("p",{className:"meat-warning",children:["标签定义或二分类曾变化,已忽略 ",t.semantic.conflict_count," 个冲突/已移除类别的细标签;请复核并保存,其余细标签已保留。"]}),t.semantic.status==="stale"&&r.jsx("p",{className:"meat-warning",children:"原皮肤已变化,旧细分类已停用;保存时将归档旧文件。"}),r.jsxs("label",{className:"semantic-category",children:["细分类 ",r.jsx("select",{"aria-label":"细分类类别",value:c,onChange:e=>m(Number(e.target.value)),children:a.map(e=>r.jsxs("option",{value:e.id,children:[e.label," · ",e.meat?"meat":"非 meat"]},e.id))})]}),r.jsx("div",{className:"semantic-legend",children:a.map(e=>r.jsxs("button",{className:c===e.id?"active":"",style:{borderColor:e.color},onClick:()=>m(e.id),children:[r.jsx("i",{style:{background:e.color}}),e.label]},e.id))})]}),f&&r.jsx("p",{role:"status",className:"meat-warning",children:f}),r.jsxs("div",{className:"meat-toolbar",children:[r.jsxs("div",{role:"group","aria-label":"标注方式",children:[r.jsx("button",{className:X==="toggle"?"active":"",onClick:()=>C("toggle"),children:"点击切换选中"}),r.jsx("button",{className:X==="erase"?"active":"",onClick:()=>C("erase"),children:"擦除"})]}),r.jsxs("label",{className:"meat-tolerance",children:["颜色容差 ",r.jsx("input",{"aria-label":"泛洪颜色容差",type:"range",min:"0",max:"100",step:"1",value:U,onChange:e=>P(Number(e.target.value))}),r.jsxs("output",{children:[U,"%"]})]}),r.jsxs("label",{children:["查看图层 ",r.jsxs("select",{value:_,onChange:e=>G(e.target.value),children:[r.jsx("option",{value:"both",children:"内层+外层"}),r.jsx("option",{value:"inner",children:"仅内层"}),r.jsx("option",{value:"outer",children:"仅外层"})]})]}),r.jsx("button",{disabled:M||Y.index===0,onClick:()=>re(-1),children:"撤销"}),r.jsx("button",{disabled:M||Y.index===Y.entries.length-1,onClick:()=>re(1),children:"重做"}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:Z,onChange:e=>ve(e.target.checked)}),"呼吸边框"]})]}),r.jsxs("div",{className:"meat-workspace",children:[r.jsxs("section",{children:[r.jsxs("h3",{children:["3D 选择 ",r.jsx("small",{children:"正交投影 · 拖拽旋转 · 点击切换 · 滚轮缩放"})]}),r.jsx("div",{className:"meat-views",children:Object.entries({front:"正面",back:"背面",left:"左侧",right:"右侧",top:"头顶",bottom:"底部",angle:"斜视(参考)"}).map(([e,n])=>r.jsx("button",{className:K===e?"active":"",onClick:()=>{W(e),Q(x=>x+1)},children:n},e))}),r.jsx("div",{className:"meat-stage",onContextMenu:e=>e.preventDefault(),onPointerDownCapture:e=>{e.isPrimary===!1?I.current&&(I.current.cancelled=!0):I.current=_e(e)},onPointerMoveCapture:e=>fe(I.current,e),onPointerUpCapture:e=>fe(I.current,e),onPointerCancelCapture:()=>{I.current&&(I.current.cancelled=!0)},children:r.jsx(ke,{orthographic:!0,camera:{position:[0,-2,48],zoom:12,near:.1,far:500},children:r.jsx(Ye,{data:t,rgba:A,mask:T,palette:d,layer:_,animate:Z,view:K,viewEpoch:J,pickDown:xe,pickUp:be,hover:ae})})})]}),r.jsxs("section",{children:[r.jsxs("h3",{children:["UV 逐格选择 ",r.jsx("small",{children:O===null?"透明区域不参与标注":`UV (${O%64}, ${Math.floor(O/64)})`})]}),r.jsx("canvas",{className:"meat-uv","aria-label":"64×64 meat UV 标注",width:512,height:512,ref:ie,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>ue(e,!0),onPointerMove:e=>ue(e,!1),onPointerUp:E})]})]}),r.jsxs("p",{className:"meat-help",children:["拖动后可点视角按钮回到正对方向,核对完全遮挡的格子。",i?"不同颜色的网格边框表示细分类;擦除仅恢复为未知,不改变 meat":"绿色网格边框表示选中的 meat",",格子内部保留皮肤原色。Ctrl+点击:沿同一部件、同一层的相连表面选择近似颜色;已选区域再次点击即可取消,Ctrl+点击已选格可批量取消。容差越大,包含颜色越多。UV 图可按住左键连续涂选或擦除。"]}),r.jsxs("footer",{className:"meat-footer",children:[r.jsxs("span",{"aria-live":"polite",children:["已选 ",le.selected," / ",le.valid," 格",z?" · 未保存":"",r.jsx("small",{children:i?`保存为 ${t.id}_semantic.png;未细标的格为未知,原 meat 文件保持不变。`:`保存为 ${t.id}_meat.png;未选择的有效格为非 meat。`})]}),r.jsx("button",{className:"button secondary",disabled:M,onClick:()=>{E(),l(i?Array.from(j.current):Array.from(j.current.keys()).filter(e=>j.current[e]),!1,S)},children:i?"保存细分类":"保存 meat"}),!i&&r.jsx("button",{className:"button",disabled:M,onClick:()=>{E(),l(Array.from(j.current.keys()).filter(e=>j.current[e]),!0,S)},children:"保存并标注下一张"})]})]})}function Ge({data:t,busy:o,onSave:l,onSaveSemantic:v,onDirty:i}){const[c,m]=s.useState(!1),[f,h]=s.useState(!1),a=ye.useCallback(d=>{h(d),i(d)},[i]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"semantic-tabs",role:"tablist","aria-label":"标注层级",children:[r.jsx("button",{role:"tab","aria-selected":!c,disabled:f||o,onClick:()=>m(!1),children:"meat 二分类"}),r.jsx("button",{role:"tab","aria-selected":c,disabled:f||o,onClick:()=>m(!0),children:"细分类(可选)"}),r.jsx("small",{children:f?"保存或撤销修改后可切换标签层。":"已有 meat 标注保留,细分类独立保存。"})]}),r.jsx(Fe,{data:t,semantic:c,busy:o,onSave:c?v:l,onDirty:a},`${c}-${t.semantic?.semantic_revision}`)]})}export{Ge as default}; diff --git a/best_annotator/static/assets/OrbitControls-B8kTSyNG.js b/best_annotator/static/assets/OrbitControls-B8kTSyNG.js new file mode 100644 index 0000000000000000000000000000000000000000..b2e3aaa43cfd35d76294f871208758e95425747a --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-B8kTSyNG.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-FHNXxhzy.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-BNs7WpFn.js b/best_annotator/static/assets/OrbitControls-BNs7WpFn.js new file mode 100644 index 0000000000000000000000000000000000000000..2fa203278384696e67862b0d17e9f28ebd6e3bf0 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-BNs7WpFn.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-CzS-rxOV.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-CHt0YeD1.js b/best_annotator/static/assets/OrbitControls-CHt0YeD1.js new file mode 100644 index 0000000000000000000000000000000000000000..ddc39340fe89068f923fa2c486bf492438d27be2 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-CHt0YeD1.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-DqXMzOA0.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-C_CiZNu6.js b/best_annotator/static/assets/OrbitControls-C_CiZNu6.js new file mode 100644 index 0000000000000000000000000000000000000000..c9fdededbe1123ec5926d62e66eec62d70542231 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-C_CiZNu6.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-BwpaCc7o.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-D8dMCyiM.js b/best_annotator/static/assets/OrbitControls-D8dMCyiM.js new file mode 100644 index 0000000000000000000000000000000000000000..063cd336613f643cbc6d9955fb15dec4a6411dab --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-D8dMCyiM.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-Cwjw6kcd.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-DCehNZC0.js b/best_annotator/static/assets/OrbitControls-DCehNZC0.js new file mode 100644 index 0000000000000000000000000000000000000000..f6a1a66b2e9280ecd1adc7a300f9e729a076e392 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-DCehNZC0.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-F-L6ur0r.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-DQYijb2B.js b/best_annotator/static/assets/OrbitControls-DQYijb2B.js new file mode 100644 index 0000000000000000000000000000000000000000..8e43d80d069f8ae0e868c989628741346eeeddd7 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-DQYijb2B.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-1xYycQFu.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-DWROePHL.js b/best_annotator/static/assets/OrbitControls-DWROePHL.js new file mode 100644 index 0000000000000000000000000000000000000000..8d3c04b9246460887b1d9d0d5319c274bac91826 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-DWROePHL.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-FsJherd9.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-DmqzLDA6.js b/best_annotator/static/assets/OrbitControls-DmqzLDA6.js new file mode 100644 index 0000000000000000000000000000000000000000..fa3faf9e159d82d760a8885ea40a48be33b30577 --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-DmqzLDA6.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-CK5rLR8o.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-JGGzURQK.js b/best_annotator/static/assets/OrbitControls-JGGzURQK.js new file mode 100644 index 0000000000000000000000000000000000000000..425d6b2433a822370aed2b0c724201282a5c8b3a --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-JGGzURQK.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-D4HloxTJ.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/OrbitControls-fNwVPk9t.js b/best_annotator/static/assets/OrbitControls-fNwVPk9t.js new file mode 100644 index 0000000000000000000000000000000000000000..ada1bf98810ae34833137713b7866666b6a15e6b --- /dev/null +++ b/best_annotator/static/assets/OrbitControls-fNwVPk9t.js @@ -0,0 +1,4060 @@ +import{a as Kx,g as Qx,R as ey,b as I1,r as ft,j as On}from"./index-Cch6ovWF.js";const of="183",ua={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ty=0,lm=1,ny=2,P1=3,iy=0,Lo=1,Ol=2,pa=3,Xs=0,si=1,ds=2,gs=0,xa=1,cm=2,um=3,hm=4,sy=5,L1=6,_r=100,ry=101,ay=102,oy=103,ly=104,cy=200,uy=201,hy=202,fy=203,ch=204,uh=205,dy=206,py=207,my=208,gy=209,vy=210,_y=211,xy=212,yy=213,by=214,hh=0,fh=1,dh=2,Sa=3,ph=4,mh=5,gh=6,vh=7,fc=0,Sy=1,My=2,Fi=0,Nm=1,Um=2,Fm=3,lf=4,Om=5,Bm=6,zm=7,fm="attached",Ey="detached",cf=300,vs=301,Mr=302,Bl=303,zl=304,Go=306,Zl=1e3,pi=1001,$l=1002,pn=1003,km=1004,D1=1004,Ro=1005,N1=1005,Qt=1006,kl=1007,U1=1007,ps=1008,F1=1008,ti=1009,Vm=1010,Hm=1011,No=1012,uf=1013,Oi=1014,ii=1015,_s=1016,hf=1017,ff=1018,Uo=1020,Gm=35902,Wm=35899,Xm=1021,qm=1022,jn=1023,xs=1026,yr=1027,df=1028,dc=1029,Ma=1030,pf=1031,O1=1032,mf=1033,Vl=33776,Hl=33777,Gl=33778,Wl=33779,_h=35840,xh=35841,yh=35842,bh=35843,Sh=36196,Mh=37492,Eh=37496,Th=37488,wh=37489,Ah=37490,Ch=37491,Rh=37808,Ih=37809,Ph=37810,Lh=37811,Dh=37812,Nh=37813,Uh=37814,Fh=37815,Oh=37816,Bh=37817,zh=37818,kh=37819,Vh=37820,Hh=37821,Gh=36492,Wh=36494,Xh=36495,qh=36283,Yh=36284,jh=36285,Zh=36286,Ty=2200,wy=2201,Ay=2202,Jl=2300,$h=2301,rh=2302,dm=2303,ma=2400,ga=2401,Kl=2402,gf=2500,Ym=2501,B1=0,z1=1,k1=2,Cy=3200,V1=3201,H1=3202,G1=3203,Ar=0,Ry=1,Vs="",Yn="srgb",Er="srgb-linear",Ql="linear",Wt="srgb",W1="",X1="rg",q1="ga",Y1=0,fa=7680,j1=7681,Z1=7682,$1=7683,J1=34055,K1=34056,Q1=5386,eE=512,tE=513,nE=514,iE=515,sE=516,rE=517,aE=518,pm=519,Iy=512,Py=513,Ly=514,vf=515,Dy=516,Ny=517,_f=518,Uy=519,ec=35044,oE=35048,lE=35040,cE=35045,uE=35049,hE=35041,fE=35046,dE=35050,pE=35042,mE="100",mm="300 es",Ai=2e3,Ea=2001,gE={COMPUTE:"compute",RENDER:"render"},vE={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_E={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},xE={TEXTURE_COMPARE:"depthTextureCompare"};function yE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const bE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Io(r,e){return new bE[r](e)}function Fy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Oy(){const r=tc("canvas");return r.style.display="block",r}const n_={};let Tr=null;function SE(r){Tr=r}function ME(){return Tr}function nc(...r){const e="THREE."+r.shift();Tr?Tr("log",e,...r):console.log(e,...r)}function By(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function it(...r){r=By(r);const e="THREE."+r.shift();if(Tr)Tr("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function ic(...r){const e=r.join(" ");e in n_||(n_[e]=!0,ke(...r))}function EE(r,e,t){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const TE={[hh]:fh,[dh]:gh,[ph]:vh,[Sa]:mh,[fh]:hh,[gh]:dh,[vh]:ph,[mh]:Sa};let ys=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;o>8&255]+Wn[r>>16&255]+Wn[r>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[t&63|128]+Wn[t>>8&255]+"-"+Wn[t>>16&255]+Wn[t>>24&255]+Wn[n&255]+Wn[n>>8&255]+Wn[n>>16&255]+Wn[n>>24&255]).toLowerCase()}function dt(r,e,t){return Math.max(e,Math.min(t,r))}function jm(r,e){return(r%e+e)%e}function wE(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function AE(r,e,t){return r!==e?(t-r)/(e-r):0}function Xl(r,e,t){return(1-t)*r+t*e}function CE(r,e,t,n){return Xl(r,e,1-Math.exp(-t*n))}function RE(r,e=1){return e-Math.abs(jm(r,e*2)-e)}function IE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function PE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function LE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function DE(r,e){return r+Math.random()*(e-r)}function NE(r){return r*(.5-Math.random())}function UE(r){r!==void 0&&(i_=r);let e=i_+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FE(r){return r*ya}function OE(r){return r*Fo}function BE(r){return(r&r-1)===0&&r!==0}function zE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VE(r,e,t,n,i){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),f=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),m=l((e-n)/2),v=o((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":r.set(c*p,h*g,h*m,c*f);break;case"YZY":r.set(h*m,c*p,h*g,c*f);break;case"ZXZ":r.set(h*g,h*m,c*p,c*f);break;case"XZX":r.set(c*p,h*_,h*v,c*f);break;case"YXY":r.set(h*v,c*p,h*_,c*f);break;case"ZYZ":r.set(h*_,h*v,c*p,c*f);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ni(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function St(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const HE={DEG2RAD:ya,RAD2DEG:Fo,generateUUID:Ci,clamp:dt,euclideanModulo:jm,mapLinear:wE,inverseLerp:AE,lerp:Xl,damp:CE,pingpong:RE,smoothstep:IE,smootherstep:PE,randInt:LE,randFloat:DE,randFloatSpread:NE,seededRandom:UE,degToRad:FE,radToDeg:OE,isPowerOfTwo:BE,ceilPowerOfTwo:zE,floorPowerOfTwo:kE,setQuaternionFromProperEuler:VE,normalize:St,denormalize:ni};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*i+e.x,this.y=o*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,o,l,c){let h=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3],m=o[l+0],v=o[l+1],_=o[l+2],E=o[l+3];if(g!==E||h!==m||f!==v||p!==_){let b=h*m+f*v+p*_+g*E;b<0&&(m=-m,v=-v,_=-_,E=-E,b=-b);let y=1-c;if(b<.9995){const M=Math.acos(b),T=Math.sin(M);y=Math.sin(y*M)/T,c=Math.sin(c*M)/T,h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c}else{h=h*y+m*c,f=f*y+v*c,p=p*y+_*c,g=g*y+E*c;const M=1/Math.sqrt(h*h+f*f+p*p+g*g);h*=M,f*=M,p*=M,g*=M}}e[t]=h,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,o,l){const c=n[i],h=n[i+1],f=n[i+2],p=n[i+3],g=o[l],m=o[l+1],v=o[l+2],_=o[l+3];return e[t]=c*_+p*g+h*v-f*m,e[t+1]=h*_+p*m+f*g-c*v,e[t+2]=f*_+p*v+c*m-h*g,e[t+3]=p*_-c*g-h*m-f*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(i/2),g=c(o/2),m=h(n/2),v=h(i/2),_=h(o/2);switch(l){case"XYZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g+m*v*_;break;case"YZX":this._x=m*p*g+f*v*_,this._y=f*v*g+m*p*_,this._z=f*p*_-m*v*g,this._w=f*p*g-m*v*_;break;case"XZY":this._x=m*p*g-f*v*_,this._y=f*v*g-m*p*_,this._z=f*p*_+m*v*g,this._w=f*p*g+m*v*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],o=t[8],l=t[1],c=t[5],h=t[9],f=t[2],p=t[6],g=t[10],m=n+c+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-h)*v,this._y=(o-f)*v,this._z=(l-i)*v}else if(n>c&&n>g){const v=2*Math.sqrt(1+n-c-g);this._w=(p-h)/v,this._x=.25*v,this._y=(i+l)/v,this._z=(o+f)/v}else if(c>g){const v=2*Math.sqrt(1+c-n-g);this._w=(o-f)/v,this._x=(i+l)/v,this._y=.25*v,this._z=(h+p)/v}else{const v=2*Math.sqrt(1+g-n-c);this._w=(l-i)/v,this._x=(o+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,o=e._z,l=e._w,c=t._x,h=t._y,f=t._z,p=t._w;return this._x=n*p+l*c+i*f-o*h,this._y=i*p+l*h+o*c-n*f,this._z=o*p+l*f+n*h-i*c,this._w=l*p-n*c-i*h-o*f,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,t=Math.sin(t*f)/p,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,l=e.y,c=e.z,h=e.w,f=2*(l*i-c*n),p=2*(c*t-o*i),g=2*(o*n-l*t);return this.x=t+h*f+l*g-c*p,this.y=n+h*p+c*f-o*g,this.z=i+h*g+o*p-l*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-o*c,this.y=o*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lp.copy(this).projectOnVector(e),this.sub(lp)}reflect(e){return this.sub(lp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const lp=new F,s_=new Bn;class xt{constructor(e,t,n,i,o,l,c,h,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,l,c,h,f)}set(e,t,n,i,o,l,c,h,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],g=n[7],m=n[2],v=n[5],_=n[8],E=i[0],b=i[3],y=i[6],M=i[1],T=i[4],w=i[7],P=i[2],R=i[5],U=i[8];return o[0]=l*E+c*M+h*P,o[3]=l*b+c*T+h*R,o[6]=l*y+c*w+h*U,o[1]=f*E+p*M+g*P,o[4]=f*b+p*T+g*R,o[7]=f*y+p*w+g*U,o[2]=m*E+v*M+_*P,o[5]=m*b+v*T+_*R,o[8]=m*y+v*w+_*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8];return t*l*p-t*c*f-n*o*p+n*c*h+i*o*f-i*l*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],l=e[4],c=e[5],h=e[6],f=e[7],p=e[8],g=p*l-c*f,m=c*h-p*o,v=f*o-l*h,_=t*g+n*m+i*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=g*E,e[1]=(i*f-p*n)*E,e[2]=(c*n-i*l)*E,e[3]=m*E,e[4]=(p*t-i*h)*E,e[5]=(i*o-c*t)*E,e[6]=v*E,e[7]=(n*h-f*t)*E,e[8]=(l*t-n*o)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,l,c){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*l+f*c)+l+e,-i*f,i*h,-i*(-f*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(cp.makeScale(e,t)),this}rotate(e){return this.premultiply(cp.makeRotation(-e)),this}translate(e,t){return this.premultiply(cp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cp=new xt,r_=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),a_=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GE(){const r={enabled:!0,workingColorSpace:Er,spaces:{},convert:function(i,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===Wt&&(i.r=Gs(i.r),i.g=Gs(i.g),i.b=Gs(i.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Wt&&(i.r=Do(i.r),i.g=Do(i.g),i.b=Do(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Vs?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,l){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return ic("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return ic("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Er]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Yn},outputColorSpaceConfig:{drawingBufferColorSpace:Yn}},[Yn]:{primaries:e,whitePoint:n,transfer:Wt,toXYZ:r_,fromXYZ:a_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Yn}}}),r}const Dt=GE();function Gs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Do(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let so;class zy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{so===void 0&&(so=tc("canvas")),so.width=e.width,so.height=e.height;const i=so.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=so}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),o=i.data;for(let l=0;l1),this.pmremVersion=0}get width(){return this.source.getSize(hp).x}get height(){return this.source.getSize(hp).y}get depth(){return this.source.getSize(hp).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zl:e.x=e.x-Math.floor(e.x);break;case pi:e.x=e.x<0?0:1;break;case $l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Zl:e.y=e.y-Math.floor(e.y);break;case pi:e.y=e.y<0?0:1;break;case $l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=cf;ln.DEFAULT_ANISOTROPY=1;class Zt{constructor(e=0,t=0,n=0,i=1){Zt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o;const h=e.elements,f=h[0],p=h[4],g=h[8],m=h[1],v=h[5],_=h[9],E=h[2],b=h[6],y=h[10];if(Math.abs(p-m)<.01&&Math.abs(g-E)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+E)<.1&&Math.abs(_+b)<.1&&Math.abs(f+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,w=(v+1)/2,P=(y+1)/2,R=(p+m)/4,U=(g+E)/4,A=(_+b)/4;return T>w&&T>P?T<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(T),i=R/n,o=U/n):w>P?w<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=A/i):P<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(P),n=U/o,i=A/o),this.set(n,i,o,t),this}let M=Math.sqrt((b-_)*(b-_)+(g-E)*(g-E)+(m-p)*(m-p));return Math.abs(M)<.001&&(M=1),this.x=(b-_)/M,this.y=(g-E)/M,this.z=(m-p)/M,this.w=Math.acos((f+v+y-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dt(this.x,e.x,t.x),this.y=dt(this.y,e.y,t.y),this.z=dt(this.z,e.z,t.z),this.w=dt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dt(this.x,e,t),this.y=dt(this.y,e,t),this.z=dt(this.z,e,t),this.w=dt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Zm extends ys{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zt(0,0,e,t),this.scissorTest=!1,this.viewport=new Zt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},o=new ln(i),l=n.count;for(let c=0;c1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const h=[];for(const f in c){const p=c[f];delete p.metadata,h.push(p)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nv+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-_&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(eT)))}return c!==null&&(c.visible=i!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Po;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const ky={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},fu={h:0,s:0,l:0};function dp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=jm(e,1),t=dt(t,0,1),n=dt(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=dp(l,o,e+1/3),this.g=dp(l,o,e),this.b=dp(l,o,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=Yn){function n(o){o!==void 0&&parseFloat(o)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yn){const n=ky[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gs(e.r),this.g=Gs(e.g),this.b=Gs(e.b),this}copyLinearToSRGB(e){return this.r=Do(e.r),this.g=Do(e.g),this.b=Do(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yn){return Dt.workingToColorSpace(Xn.copy(this),e),Math.round(dt(Xn.r*255,0,255))*65536+Math.round(dt(Xn.g*255,0,255))*256+Math.round(dt(Xn.b*255,0,255))}getHexString(e=Yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Xn.copy(this),t);const n=Xn.r,i=Xn.g,o=Xn.b,l=Math.max(n,i,o),c=Math.min(n,i,o);let h,f;const p=(c+l)/2;if(c===l)h=0,f=0;else{const g=l-c;switch(f=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(i-o)/g+(i0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Qi=new F,Us=new F,pp=new F,Fs=new F,lo=new F,co=new F,p_=new F,mp=new F,gp=new F,vp=new F,_p=new Zt,xp=new Zt,yp=new Zt;class di{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Qi.subVectors(e,t),i.cross(Qi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Qi.subVectors(i,t),Us.subVectors(n,t),pp.subVectors(e,t);const l=Qi.dot(Qi),c=Qi.dot(Us),h=Qi.dot(pp),f=Us.dot(Us),p=Us.dot(pp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;const m=1/g,v=(f*h-c*p)*m,_=(l*p-c*h)*m;return o.set(1-v-_,_,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fs)===null?!1:Fs.x>=0&&Fs.y>=0&&Fs.x+Fs.y<=1}static getInterpolation(e,t,n,i,o,l,c,h){return this.getBarycoord(e,t,n,i,Fs)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Fs.x),h.addScaledVector(l,Fs.y),h.addScaledVector(c,Fs.z),h)}static getInterpolatedAttribute(e,t,n,i,o,l){return _p.setScalar(0),xp.setScalar(0),yp.setScalar(0),_p.fromBufferAttribute(e,t),xp.fromBufferAttribute(e,n),yp.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(_p,o.x),l.addScaledVector(xp,o.y),l.addScaledVector(yp,o.z),l}static isFrontFacing(e,t,n,i){return Qi.subVectors(n,t),Us.subVectors(e,t),Qi.cross(Us).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),Us.subVectors(this.a,this.b),Qi.cross(Us).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let l,c;lo.subVectors(i,n),co.subVectors(o,n),mp.subVectors(e,n);const h=lo.dot(mp),f=co.dot(mp);if(h<=0&&f<=0)return t.copy(n);gp.subVectors(e,i);const p=lo.dot(gp),g=co.dot(gp);if(p>=0&&g<=p)return t.copy(i);const m=h*g-p*f;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(n).addScaledVector(lo,l);vp.subVectors(e,o);const v=lo.dot(vp),_=co.dot(vp);if(_>=0&&v<=_)return t.copy(o);const E=v*f-h*_;if(E<=0&&f>=0&&_<=0)return c=f/(f-_),t.copy(n).addScaledVector(co,c);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return p_.subVectors(o,i),c=(g-p)/(g-p+(v-_)),t.copy(i).addScaledVector(p_,c);const y=1/(b+E+m);return l=E*y,c=m*y,t.copy(n).addScaledVector(lo,l).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Zn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sl),pu.subVectors(this.max,Sl),uo.subVectors(e.a,Sl),ho.subVectors(e.b,Sl),fo.subVectors(e.c,Sl),fr.subVectors(ho,uo),dr.subVectors(fo,ho),$r.subVectors(uo,fo);let t=[0,-fr.z,fr.y,0,-dr.z,dr.y,0,-$r.z,$r.y,fr.z,0,-fr.x,dr.z,0,-dr.x,$r.z,0,-$r.x,-fr.y,fr.x,0,-dr.y,dr.x,0,-$r.y,$r.x,0];return!bp(t,uo,ho,fo,pu)||(t=[1,0,0,0,1,0,0,0,1],!bp(t,uo,ho,fo,pu))?!1:(mu.crossVectors(fr,dr),t=[mu.x,mu.y,mu.z],bp(t,uo,ho,fo,pu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Os[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Os[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Os[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Os[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Os[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Os[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Os[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Os[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Os),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Os=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,du=new Zn,uo=new F,ho=new F,fo=new F,fr=new F,dr=new F,$r=new F,Sl=new F,pu=new F,mu=new F,Jr=new F;function bp(r,e,t,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Jr.fromArray(r,o);const c=i.x*Math.abs(Jr.x)+i.y*Math.abs(Jr.y)+i.z*Math.abs(Jr.z),h=e.dot(Jr),f=t.dot(Jr),p=n.dot(Jr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}const Hs=tT();function tT(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const f=h-127;f<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,i[h]=-f-1,i[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,i[h]=13,i[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,o[h]=f|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:o,exponentTable:l,offsetTable:c}}function fi(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=dt(r,-65504,65504),Hs.floatView[0]=r;const e=Hs.uint32View[0],t=e>>23&511;return Hs.baseTable[t]+((e&8388607)>>Hs.shiftTable[t])}function Nl(r){const e=r>>10;return Hs.uint32View[0]=Hs.mantissaTable[Hs.offsetTable[e]+(r&1023)]+Hs.exponentTable[e],Hs.floatView[0]}class nT{static toHalfFloat(e){return fi(e)}static fromHalfFloat(e){return Nl(e)}}const yn=new F,gu=new ue;let iT=0;class Yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iT++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ec,this.updateRanges=[],this.gpuType=ii,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ml.subVectors(e,this.center);const t=Ml.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ml,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ml.copy(e.center).add(Sp)),this.expandByPoint(Ml.copy(e.center).sub(Sp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hT=0;const Ui=new mt,Mp=new Ft,po=new F,wi=new Zn,El=new Zn,Ln=new F;class vt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(yE(e)?Km:Jm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new xt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Mp.lookAt(e),Mp.updateMatrix(),this.applyMatrix4(Mp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(po).negate(),this.translate(po.x,po.y,po.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,o=e.length;it.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const i={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],p=[];for(let g=0,m=f.length;g0&&(i[h]=p,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const o=e.morphAttributes;for(const f in o){const p=[],g=o[f];for(let m=0,v=g.length;m0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xa&&(n.blending=this.blending),this.side!==Xs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ch&&(n.blendSrc=this.blendSrc),this.blendDst!==uh&&(n.blendDst=this.blendDst),this.blendEquation!==_r&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Sa&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=i(e.textures),l=i(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qm extends $n{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const Tl=new F,go=new F,vo=new F,_o=new ue,wl=new ue,Vy=new mt,vu=new F,Al=new F,_u=new F,m_=new ue,Ep=new ue,g_=new ue;class Hy extends Ft{constructor(e=new Qm){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new Ta(n,3,0,!1)),mo.setAttribute("uv",new Ta(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),Vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const l=this.center;xu(vu.set(-.5,-.5,0),vo,l,go,i,o),xu(Al.set(.5,-.5,0),vo,l,go,i,o),xu(_u.set(.5,.5,0),vo,l,go,i,o),m_.set(0,0),Ep.set(1,0),g_.set(1,1);let c=e.ray.intersectTriangle(vu,Al,_u,!1,Tl);if(c===null&&(xu(Al.set(-.5,.5,0),vo,l,go,i,o),Ep.set(0,1),c=e.ray.intersectTriangle(vu,_u,Al,!1,Tl),c===null))return;const h=e.ray.origin.distanceTo(Tl);he.far||t.push({distance:h,point:Tl.clone(),uv:di.getInterpolation(Tl,vu,Al,_u,m_,Ep,g_,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function xu(r,e,t,n,i,o){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(wl.x=o*_o.x-i*_o.y,wl.y=i*_o.x+o*_o.y):wl.copy(_o),r.copy(e),r.x+=wl.x,r.y+=wl.y,r.applyMatrix4(Vy)}const yu=new F,v_=new F;class Gy extends Ft{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),v_.setFromMatrixPosition(this.matrixWorld);const n=yu.distanceTo(v_)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(g=l*h-c,m=l*c-h,_=o*p,g>=0)if(m>=-_)if(m<=_){const E=1/p;g*=E,m*=E,v=g*(g+l*m+2*c)+m*(l*g+m+2*h)+f}else m=o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m=-o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;else m<=-_?(g=Math.max(0,-(-l*o+c)),m=g>0?-o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f):m<=_?(g=0,m=Math.min(Math.max(-o,-h),o),v=m*(m+2*h)+f):(g=Math.max(0,-(l*o+c)),m=g>0?o:Math.min(Math.max(-o,-h),o),v=-g*g+m*(m+2*h)+f);else m=l>0?-o:o,g=Math.max(0,-(l*m+c)),v=-g*g+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Tp).addScaledVector(bu,m),v}intersectSphere(e,t){Bs.subVectors(e.center,this.origin);const n=Bs.dot(this.direction),i=Bs.dot(Bs)-n*n,o=e.radius*e.radius;if(i>o)return null;const l=Math.sqrt(o-i),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,l,c,h;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(e.min.z-m.z)*g,h=(e.max.z-m.z)*g):(c=(e.max.z-m.z)*g,h=(e.min.z-m.z)*g),n>h||c>i)||((c>n||n!==n)&&(n=c),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bs)!==null}intersectTriangle(e,t,n,i,o){wp.subVectors(t,e),Su.subVectors(n,e),Ap.crossVectors(wp,Su);let l=this.direction.dot(Ap),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;pr.subVectors(this.origin,e);const h=c*this.direction.dot(Su.crossVectors(pr,Su));if(h<0)return null;const f=c*this.direction.dot(wp.cross(pr));if(f<0||h+f>l)return null;const p=-c*pr.dot(Ap);return p<0?null:this.at(p/l,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Cr extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const __=new mt,Kr=new Ca,Mu=new zn,x_=new F,Eu=new F,Tu=new F,wu=new F,Cp=new F,Au=new F,y_=new F,Cu=new F;class bn extends Ft{constructor(e=new vt,t=new Cr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(e.far-e.near)**2))&&(__.copy(o).invert(),Kr.copy(e.ray).applyMatrix4(__),!(n.boundingBox!==null&&Kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Kr)))}_computeIntersections(e,t,n){let i;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,f=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,m=o.groups,v=o.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,E=m.length;_t.far?null:{distance:f,point:Cu.clone(),object:r}}function Ru(r,e,t,n,i,o,l,c,h,f){r.getVertexPosition(c,Eu),r.getVertexPosition(h,Tu),r.getVertexPosition(f,wu);const p=dT(r,e,t,n,Eu,Tu,wu,y_);if(p){const g=new F;di.getBarycoord(y_,Eu,Tu,wu,g),i&&(p.uv=di.getInterpolatedAttribute(i,c,h,f,g,new ue)),o&&(p.uv1=di.getInterpolatedAttribute(o,c,h,f,g,new ue)),l&&(p.normal=di.getInterpolatedAttribute(l,c,h,f,g,new F),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const m={a:c,b:h,c:f,normal:new F,materialIndex:0};di.getNormal(Eu,Tu,wu,m.normal),p.face=m,p.barycoord=g}return p}const b_=new F,S_=new Zt,M_=new Zt,pT=new F,E_=new mt,Iu=new F,Rp=new zn,T_=new mt,Ip=new Ca;class Wy extends bn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fm,this.bindMatrix=new mt,this.bindMatrixInverse=new mt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_T.getNormalMatrix(e),i=this.coplanarPoint(Pp).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qr=new zn,xT=new ue(.5,.5),Lu=new F;class Wo{constructor(e=new ks,t=new ks,n=new ks,i=new ks,o=new ks,l=new ks){this.planes=[e,t,n,i,o,l]}set(e,t,n,i,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],f=o[3],p=o[4],g=o[5],m=o[6],v=o[7],_=o[8],E=o[9],b=o[10],y=o[11],M=o[12],T=o[13],w=o[14],P=o[15];if(i[0].setComponents(f-l,v-p,y-_,P-M).normalize(),i[1].setComponents(f+l,v+p,y+_,P+M).normalize(),i[2].setComponents(f+c,v+g,y+E,P+T).normalize(),i[3].setComponents(f-c,v-g,y-E,P-T).normalize(),n)i[4].setComponents(h,m,b,w).normalize(),i[5].setComponents(f-h,v-m,y-b,P-w).normalize();else if(i[4].setComponents(f-h,v-m,y-b,P-w).normalize(),t===Ai)i[5].setComponents(f+h,v+m,y+b,P+w).normalize();else if(t===Ea)i[5].setComponents(h,m,b,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qr)}intersectsSprite(e){Qr.center.set(0,0,0);const t=xT.distanceTo(e.center);return Qr.radius=.7071067811865476+t,Qr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)0?e.max.x:e.min.x,Lu.y=i.normal.y>0?e.max.y:e.min.y,Lu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const cs=new mt,us=new Wo;class Tf{constructor(){this.coordinateSystem=Ai}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const hi=new mt,MT=new Xe(1,1,1),R_=new Wo,ET=new Tf,Du=new Zn,ea=new zn,Il=new F,I_=new F,TT=new F,Dp=new ST,qn=new bn,Nu=[];function wT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let o=0;o65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),o=t.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;hi.identity().toArray(o.image.data,i*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(MT.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Lp),h=this._availableGeometryIds.shift(),o[h]=i):(h=this._geometryCount,this._geometryCount++,o.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),m=n.getAttribute(p);wT(g,m,h);const v=g.itemSize;for(let _=g.count,E=f;_=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,o=n.length;ic).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const o=new Zn,l=n.index,c=n.attributes.position;for(let h=i.start,f=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const o=new zn;this.getBoundingBoxAt(e,Du),Du.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let f=i.start,p=i.start+i.count;fc.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new vt,this._initializeGeometry(o));const l=this.geometry;o.index&&ta(o.index.array,l.index.array);for(const c in o.attributes)ta(o.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,o=this.matrixWorld,l=this.geometry;qn.material=this.material,qn.geometry.index=l.index,qn.geometry.attributes=l.attributes,qn.geometry.boundingBox===null&&(qn.geometry.boundingBox=new Zn),qn.geometry.boundingSphere===null&&(qn.geometry.boundingSphere=new zn);for(let c=0,h=n.length;c({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,h=1;o.wireframe&&(h=2,c=i.attributes.position.count>65535?4:2);const f=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,m=this._geometryInfo,v=this.perObjectFrustumCulled,_=this._indirectTexture,E=_.image.data,b=n.isArrayCamera?ET:R_;v&&!n.isArrayCamera&&(hi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),R_.setFromProjectionMatrix(hi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){hi.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hi),I_.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hi);for(let w=0,P=f.length;w0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;on)return;Np.applyMatrix4(r.matrixWorld);const f=e.ray.origin.distanceTo(Np);if(!(fe.far))return{distance:f,point:L_.clone().applyMatrix4(r.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:r}}const D_=new F,N_=new F;class bs extends wr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,o=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class Zy extends ln{constructor(e,t,n,i,o=Qt,l=Qt,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class AT extends Zy{constructor(e,t,n,i,o,l,c,h){super({},e,t,n,i,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class CT extends ln{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pn,this.minFilter=pn,this.generateMipmaps=!1,this.needsUpdate=!0}}class wf extends ln{constructor(e,t,n,i,o,l,c,h,f,p,g,m){super(null,l,c,h,f,p,i,o,g,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RT extends wf{constructor(e,t,n,i,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=pi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IT extends wf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,vs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pc extends ln{constructor(e=[],t=vs,n,i,o,l,c,h,f,p){super(e,t,n,i,o,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PT extends ln{constructor(e,t,n,i,o,l,c,h,f){super(e,t,n,i,o,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zo extends ln{constructor(e,t,n=Oi,i,o,l,c=pn,h=pn,f,p=xs,g=1){if(p!==xs&&p!==yr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:g};super(m,i,o,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new br(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $y extends zo{constructor(e,t=Oi,n=vs,i,o,l=pn,c=pn,h,f=xs){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,i,o,l,c,h,f),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ng extends ln{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ra extends vt{constructor(e=1,t=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};const c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);const h=[],f=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,n,t,e,l,o,0),_("z","y","x",1,-1,n,t,-e,l,o,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,o,4),_("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(h),this.setAttribute("position",new Ze(f,3)),this.setAttribute("normal",new Ze(p,3)),this.setAttribute("uv",new Ze(g,2));function _(E,b,y,M,T,w,P,R,U,A,I){const z=w/U,O=P/A,X=w/2,G=P/2,j=R/2,q=U+1,$=A+1;let J=0,pe=0;const ce=new F;for(let Ee=0;Ee<$;Ee++){const me=Ee*O-G;for(let _e=0;_e0?1:-1,p.push(ce.x,ce.y,ce.z),g.push(_e/U),g.push(1-Ee/A),J+=1}}for(let Ee=0;Ee0){const I=(M-1)*E;for(let z=0;z0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ze(g,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(v,2));function M(){const w=new F,P=new F;let R=0;const U=(t-e)/n;for(let A=0;A<=o;A++){const I=[],z=A/o,O=z*(t-e)+e;for(let X=0;X<=i;X++){const G=X/i,j=G*h+c,q=Math.sin(j),$=Math.cos(j);P.x=O*q,P.y=-z*n+b,P.z=O*$,g.push(P.x,P.y,P.z),w.set(q,U,$).normalize(),m.push(w.x,w.y,w.z),v.push(G,1-z),I.push(_++)}E.push(I)}for(let A=0;A0||I!==0)&&(p.push(z,O,G),R+=3),(t>0||I!==o-1)&&(p.push(O,X,G),R+=3)}f.addGroup(y,R,0),y+=R}function T(w){const P=_,R=new ue,U=new F;let A=0;const I=w===!0?e:t,z=w===!0?1:-1;for(let X=1;X<=i;X++)g.push(0,b*z,0),m.push(0,z,0),v.push(.5,.5),_++;const O=_;for(let X=0;X<=i;X++){const j=X/i*h+c,q=Math.cos(j),$=Math.sin(j);U.x=I*$,U.y=b*z,U.z=I*q,g.push(U.x,U.y,U.z),m.push(0,z,0),R.x=q*.5+.5,R.y=$*.5*z+.5,v.push(R.x,R.y),_++}for(let X=0;X.9&&U<.1&&(T<.2&&(l[M+0]+=1),w<.2&&(l[M+2]+=1),P<.2&&(l[M+4]+=1))}}function m(M){o.push(M.x,M.y,M.z)}function v(M,T){const w=M*3;T.x=e[w+0],T.y=e[w+1],T.z=e[w+2]}function _(){const M=new F,T=new F,w=new F,P=new F,R=new ue,U=new ue,A=new ue;for(let I=0,z=0;I0)h=i-1;else{h=i;break}if(i=h,n[i]===l)return i/(o-1);const p=n[i],m=n[i+1]-p,v=(l-p)/m;return(i+v)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const l=this.getPoint(i),c=this.getPoint(o),h=t||(l.isVector2?new ue:new F);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],o=[],l=[],c=new F,h=new mt;for(let v=0;v<=e;v++){const _=v/e;i[v]=this.getTangentAt(_,new F)}o[0]=new F,l[0]=new F;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),m=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),m<=f&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],c),l[0].crossVectors(i[0],o[0]);for(let v=1;v<=e;v++){if(o[v]=o[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(i[v-1],i[v]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(dt(i[v-1].dot(i[v]),-1,1));o[v].applyMatrix4(h.makeRotationAxis(c,_))}l[v].crossVectors(i[v],o[v])}if(t===!0){let v=Math.acos(dt(o[0].dot(o[e]),-1,1));v/=e,i[0].dot(c.crossVectors(o[0],o[e]))>0&&(v=-v);for(let _=1;_<=e;_++)o[_].applyMatrix4(h.makeRotationAxis(i[_],v*_)),l[_].crossVectors(i[_],o[_])}return{tangents:i,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class If extends ss{constructor(e=0,t=0,n=1,i=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)i;)o-=i;o0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let f,p;this.closed||c>0?f=i[(c-1)%o]:(Hu.subVectors(i[0],i[1]).add(i[0]),f=Hu);const g=i[c%o],m=i[(c+1)%o];if(this.closed||c+2i.length-2?i.length-1:l+1],g=i[l>i.length-3?i.length-1:l+2];return n.set(O_(c,h.x,f.x,p.x,g.x),O_(c,h.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const l=i[o]-n,c=this.curves[o],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,t)}o++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends ef{constructor(e){super(e),this.uuid=Ci(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){c=r[0],h=r[1];let p=c,g=h;for(let m=t;mp&&(p=v),_>g&&(g=_)}f=Math.max(p-c,g-h),f=f!==0?32767/f:0}return sc(o,l,t,c,h,f,0),l}function ib(r,e,t,n,i){let o;if(i===tw(r,e,t,n)>0)for(let l=e;l=e;l-=n)o=B_(l/n|0,r[l],r[l+1],o);return o&&ko(o,o.next)&&(ac(o),o=o.next),o}function wa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ko(t,t.next)||rn(t.prev,t,t.next)===0)){if(ac(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function sc(r,e,t,n,i,o,l){if(!r)return;!l&&o&&ZT(r,n,i,o);let c=r;for(;r.prev!==r.next;){const h=r.prev,f=r.next;if(o?VT(r,n,i,o):kT(r)){e.push(h.i,r.i,f.i),ac(r),r=f.next,c=f.next;continue}if(r=f,r===c){l?l===1?(r=HT(wa(r),e),sc(r,e,t,n,i,o,2)):l===2&>(r,e,t,n,i,o):sc(wa(r),e,t,n,i,o,1);break}}}function kT(r){const e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;const i=e.x,o=t.x,l=n.x,c=e.y,h=t.y,f=n.y,p=Math.min(i,o,l),g=Math.min(c,h,f),m=Math.max(i,o,l),v=Math.max(c,h,f);let _=n.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&Ul(i,c,o,h,l,f,_.x,_.y)&&rn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function VT(r,e,t,n){const i=r.prev,o=r,l=r.next;if(rn(i,o,l)>=0)return!1;const c=i.x,h=o.x,f=l.x,p=i.y,g=o.y,m=l.y,v=Math.min(c,h,f),_=Math.min(p,g,m),E=Math.max(c,h,f),b=Math.max(p,g,m),y=vm(v,_,e,t,n),M=vm(E,b,e,t,n);let T=r.prevZ,w=r.nextZ;for(;T&&T.z>=y&&w&&w.z<=M;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=y;){if(T.x>=v&&T.x<=E&&T.y>=_&&T.y<=b&&T!==i&&T!==l&&Ul(c,p,h,g,f,m,T.x,T.y)&&rn(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z<=M;){if(w.x>=v&&w.x<=E&&w.y>=_&&w.y<=b&&w!==i&&w!==l&&Ul(c,p,h,g,f,m,w.x,w.y)&&rn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function HT(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ko(n,i)&&rb(n,t,t.next,i)&&rc(n,i)&&rc(i,n)&&(e.push(n.i,t.i,i.i),ac(t),ac(t.next),t=r=i),t=t.next}while(t!==r);return wa(t)}function GT(r,e,t,n,i,o){let l=r;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&KT(l,c)){let h=ab(l,c);l=wa(l,l.next),h=wa(h,h.next),sc(l,e,t,n,i,o,0),sc(h,e,t,n,i,o,0);return}c=c.next}l=l.next}while(l!==r)}function WT(r,e,t,n){const i=[];for(let o=0,l=e.length;o=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x=t.x&&t.x>=h&&n!==t.x&&sb(il.x||t.x===l.x&&jT(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function jT(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function ZT(r,e,t,n){let i=r;do i.z===0&&(i.z=vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,$T(i)}function $T(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let f=0;f0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,h--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=l}o.nextZ=null,t*=2}while(e>1);return r}function vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function JT(r){let e=r,t=r;do(e.x=(r-l)*(o-c)&&(r-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(i-l)*(n-c)}function Ul(r,e,t,n,i,o,l,c){return!(r===l&&e===c)&&sb(r,e,t,n,i,o,l,c)}function KT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!QT(r,e)&&(rc(r,e)&&rc(e,r)&&ew(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||ko(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ko(r,e){return r.x===e.x&&r.y===e.y}function rb(r,e,t,n){const i=Wu(rn(r,e,t)),o=Wu(rn(r,e,n)),l=Wu(rn(t,n,r)),c=Wu(rn(t,n,e));return!!(i!==o&&l!==c||i===0&&Gu(r,t,e)||o===0&&Gu(r,n,e)||l===0&&Gu(t,r,n)||c===0&&Gu(t,e,n))}function Gu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wu(r){return r>0?1:r<0?-1:0}function QT(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&rb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rc(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function ew(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ab(r,e){const t=_m(r.i,r.x,r.y),n=_m(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function B_(r,e,t,n){const i=_m(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tw(r,e,t,n){let i=0;for(let o=e,l=t-n;o2&&r[e-1].equals(r[0])&&r.pop()}function k_(r,e){for(let t=0;tNumber.EPSILON){const se=Math.sqrt(C),he=Math.sqrt(Me*Me+N*N),re=xe.x-nt/se,He=xe.y+Oe/se,Te=fe.x-N/he,Je=fe.y+Me/he,rt=((Te-re)*N-(Je-He)*Me)/(Oe*N-nt*Me);Pe=re+Oe*rt-de.x,B=He+nt*rt-de.y;const ye=Pe*Pe+B*B;if(ye<=2)return new ue(Pe,B);Qe=Math.sqrt(ye/2)}else{let se=!1;Oe>Number.EPSILON?Me>Number.EPSILON&&(se=!0):Oe<-Number.EPSILON?Me<-Number.EPSILON&&(se=!0):Math.sign(nt)===Math.sign(N)&&(se=!0),se?(Pe=-nt,B=Oe,Qe=Math.sqrt(C)):(Pe=Oe,B=nt,Qe=Math.sqrt(C/2))}return new ue(Pe/Qe,B/Qe)}const ce=[];for(let de=0,xe=q.length,fe=xe-1,Pe=de+1;de=0;de--){const xe=de/b,fe=v*Math.cos(xe*Math.PI/2),Pe=_*Math.sin(xe*Math.PI/2)+E;for(let B=0,Qe=q.length;B=0;){const Pe=fe;let B=fe-1;B<0&&(B=de.length-1);for(let Qe=0,Oe=p+b*2;Qe0)&&v.push(T,w,R),(y!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cg extends Bi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ug extends $n{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hb extends ug{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fb extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class db extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class pb extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class mb extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ii,this.combine=fc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hg extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fg extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class gb extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ar,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vb extends ri{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function va(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function _b(r){function e(i,o){return r[i]-r[o]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function xm(r,e,t){const n=r.length,i=new r.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)i[l++]=r[c+h]}return i}function dg(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=r[i++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=r[i++];while(o!==void 0)}function cw(r,e,t,n,i=30){const o=r.clone();o.name=e;const l=[];for(let h=0;h=n)){g.push(f.times[v]);for(let E=0;Eo.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h=c.times[_]){const y=_*g+p,M=y+g-p;E=c.values.slice(y,M)}else{const y=c.createInterpolant(),M=p,T=g-p;y.evaluate(o),E=y.resultBuffer.slice(M,T)}h==="quaternion"&&new Bn().fromArray(E).normalize().conjugate().toArray(E);const b=f.times.length;for(let y=0;y=o)){const c=t[1];e=o)break t}l=n,n=0;break n}break e}for(;n>>1;et;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&Fy(i))for(let c=0,h=i.length;c!==h;++c){const f=i[c];if(isNaN(f)){it("KeyframeTrack: Value is not a valid number.",this,c,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===rh,o=e.length-1;let l=1;for(let c=1;c0){e[l]=e[o];for(let c=o*n,h=l*n,f=0;f!==n;++f)t[h+f]=t[c+f];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.ValueTypeName="";zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=$h;class Ia extends zi{constructor(e,t,n){super(e,t,n)}}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Jl;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class mg extends zi{constructor(e,t,n,i){super(e,t,n,i)}}mg.prototype.ValueTypeName="color";class oc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}oc.prototype.ValueTypeName="number";class Sb extends qo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t);let f=e*c;for(let p=f+c;f!==p;f+=4)Bn.slerpFlat(o,0,l,f-c,l,f,h);return o}}class xc extends zi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Sb(this.times,this.values,this.getValueSize(),e)}}xc.prototype.ValueTypeName="quaternion";xc.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends zi{constructor(e,t,n){super(e,t,n)}}Pa.prototype.ValueTypeName="string";Pa.prototype.ValueBufferType=Array;Pa.prototype.DefaultInterpolation=Jl;Pa.prototype.InterpolantFactoryMethodLinear=void 0;Pa.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends zi{constructor(e,t,n,i){super(e,t,n,i)}}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=gf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(dw(n[l]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(zi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,l=[];for(let c=0;c1){const g=p[1];let m=i[g];m||(i[g]=m=[]),m.push(f)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return it("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,m,v,_,E){if(v.length!==0){const b=[],y=[];dg(v,b,y,_),b.length!==0&&E.push(new g(m,b,y))}},i=[],o=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let g=0;g{t&&t(o),this.manager.itemEnd(e)},0),o;if(zs[e]!==void 0){zs[e].push({onLoad:t,onProgress:n,onError:i});return}zs[e]=[],zs[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=zs[e],g=f.body.getReader(),m=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let E=0;const b=new ReadableStream({start(y){M();function M(){g.read().then(({done:T,value:w})=>{if(T)y.close();else{E+=w.byteLength;const P=new ProgressEvent("progress",{lengthComputable:_,loaded:E,total:v});for(let R=0,U=p.length;R{y.error(T)})}}});return new Response(b)}else throw new pw(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(_=>v.decode(_))}}}).then(f=>{ms.add(`file:${e}`,f);const p=zs[e];delete zs[e];for(let g=0,m=p.length;g{const p=zs[e];if(p===void 0)throw this.manager.itemError(e),f;delete zs[e];for(let g=0,m=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class mw extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const o in e.uniforms){const l=e.uniforms[o];switch(i.uniforms[o]={},l.type){case"t":i.uniforms[o].value=n(l.value);break;case"c":i.uniforms[o].value=new Xe().setHex(l.value);break;case"v2":i.uniforms[o].value=new ue().fromArray(l.value);break;case"v3":i.uniforms[o].value=new F().fromArray(l.value);break;case"v4":i.uniforms[o].value=new Zt().fromArray(l.value);break;case"m3":i.uniforms[o].value=new xt().fromArray(l.value);break;case"m4":i.uniforms[o].value=new mt().fromArray(l.value);break;default:i.uniforms[o].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const o in e.extensions)i.extensions[o]=e.extensions[o];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ue().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Vf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:lb,SpriteMaterial:Qm,RawShaderMaterial:cg,ShaderMaterial:Bi,PointsMaterial:tg,MeshPhysicalMaterial:hb,MeshStandardMaterial:ug,MeshPhongMaterial:fb,MeshToonMaterial:db,MeshNormalMaterial:pb,MeshLambertMaterial:mb,MeshDepthMaterial:hg,MeshDistanceMaterial:fg,MeshBasicMaterial:Cr,MeshMatcapMaterial:gb,LineDashedMaterial:vb,LineBasicMaterial:ri,Material:$n};return new t[e]}}class ym{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Pb extends vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Lb extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){i?i(h):it(h),o.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=o(v,b.buffer),M=Io(b.type,y),T=new Mf(M,b.stride);return T.uuid=b.uuid,t[_]=T,T}function o(v,_){if(n[_]!==void 0)return n[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new Pb:new vt,c=e.data.index;if(c!==void 0){const v=Io(c.type,c.array);l.setIndex(new Yt(v,1))}const h=e.data.attributes;for(const v in h){const _=h[v];let E;if(_.isInterleavedBufferAttribute){const b=i(e.data,_.data);E=new Ta(b,_.itemSize,_.offset,_.normalized)}else{const b=Io(_.type,_.array),y=_.isInstancedBufferAttribute?Bo:Yt;E=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(E.name=_.name),_.usage!==void 0&&E.setUsage(_.usage),l.setAttribute(v,E)}const f=e.data.morphAttributes;if(f)for(const v in f){const _=f[v],E=[];for(let b=0,y=_.length;b0){const h=new gg(t);o=new uc(h),o.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f0){i=new uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l{let y=null,M=null;return b.boundingBox!==void 0&&(y=new Zn().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new zn().fromJSON(b.boundingSphere)),{...b,boundingBox:y,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e._availableInstanceIds,l._availableGeometryIds=e._availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=f(e.matricesTexture.uuid),l._indirectTexture=f(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=f(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Zn().fromJSON(e.boundingBox));break;case"LOD":l=new Gy;break;case"Line":l=new wr(c(e.geometry),h(e.material));break;case"LineLoop":l=new Yy(c(e.geometry),h(e.material));break;case"LineSegments":l=new bs(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new jy(c(e.geometry),h(e.material));break;case"Sprite":l=new Hy(h(e.material));break;case"Group":l=new Po;break;case"Bone":l=new eg;break;default:l=new Ft}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.pivot!==void 0&&(l.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=ms.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(f=>{if(kp.has(l)===!0)i&&i(kp.get(l)),o.manager.itemError(e),o.manager.itemEnd(e);else return t&&t(f),o.manager.itemEnd(e),f});return}return setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0),l}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return ms.add(`image-bitmap:${e}`,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),kp.set(h,f),ms.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});ms.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Yu;class xg{static getContext(){return Yu===void 0&&(Yu=new(window.AudioContext||window.webkitAudioContext)),Yu}static setContext(e){Yu=e}}class ww extends mi{constructor(e){super(e)}load(e,t,n,i){const o=this,l=new qs(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const f=h.slice(0);xg.getContext().decodeAudioData(f,function(g){t(g)}).catch(c)}catch(f){c(f)}},n,i);function c(h){i?i(h):it(h),o.manager.itemError(e)}}}const $_=new mt,J_=new mt,na=new mt;class Aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,o=i*t.near/t.focus,l=t.near*Math.tan(ya*t.fov*.5)/t.zoom;let c,h;J_.elements[12]=-i,$_.elements[12]=i,c=-l*t.aspect+o,h=l*t.aspect+o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(na),c=-l*t.aspect-o,h=l*t.aspect-o,na.elements[0]=2*t.near/(h-c),na.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(J_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($_)}}const bo=-90,So=1;class Db extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dn(bo,So,e,t);i.layers=this.layers,this.add(i);const o=new dn(bo,So,e,t);o.layers=this.layers,this.add(o);const l=new dn(bo,So,e,t);l.layers=this.layers,this.add(l);const c=new dn(bo,So,e,t);c.layers=this.layers,this.add(c);const h=new dn(bo,So,e,t);h.layers=this.layers,this.add(h);const f=new dn(bo,So,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,o,l,c,h]=t;for(const f of t)this.remove(f);if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===Ea)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,f,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,i),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Nb extends dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ub{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Cw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Cw(){this._document.hidden===!1&&this.reset()}const ia=new F,Vp=new Bn,Rw=new F,sa=new F,ra=new F;class Iw extends Ft{constructor(){super(),this.type="AudioListener",this.context=xg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Ub}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ia,Vp,Rw),sa.set(0,0,-1).applyQuaternion(Vp),ra.set(0,1,0).applyQuaternion(Vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(sa.x,n),t.forwardY.linearRampToValueAtTime(sa.y,n),t.forwardZ.linearRampToValueAtTime(sa.z,n),t.upX.linearRampToValueAtTime(ra.x,n),t.upY.linearRampToValueAtTime(ra.y,n),t.upZ.linearRampToValueAtTime(ra.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(sa.x,sa.y,sa.z,ra.x,ra.y,ra.z)}}class Fb extends Ft{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,f=t+t;h!==f;++h)if(n[h]!==n[h+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,l=i;o!==l;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Bn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){const l=this._workIndex*o;Bn.multiplyQuaternionsFlat(e,l,e,t,e,n),Bn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,o){const l=1-i;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const yg="\\[\\]\\.:\\/",Nw=new RegExp("["+yg+"]","g"),bg="[^"+yg+"]",Uw="[^"+yg.replace("\\.","")+"]",Fw=/((?:WC+[\/:])*)/.source.replace("WC",bg),Ow=/(WCOD+)?/.source.replace("WCOD",Uw),Bw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),zw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),kw=new RegExp("^"+Fw+Ow+Bw+zw+"$"),Vw=["material","materials","bones","map"];class Hw{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Nw,"")}static parseTrackName(e){const t=kw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=n.nodeName.substring(i+1);Vw.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(o){for(let l=0;l=o){const g=o++,m=e[g];t[m.uuid]=p,e[p]=m,t[f]=g,e[g]=h;for(let v=0,_=i;v!==_;++v){const E=n[v],b=E[g],y=E[p];E[p]=b,E[g]=y}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const f=arguments[c],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,E=i;_!==E;++_){const b=n[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const o=this._bindings;if(i!==void 0)return o[i];const l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,g=new Array(f);i=o.length,n[e]=i,l.push(e),c.push(t),o.push(g);for(let m=p,v=h.length;m!==v;++m){const _=h[m];g[m]=new Ut(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=e[c];t[f]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),i[n]=i[c],i.pop()}}}class Bb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:ma,endingEnd:ma};for(let f=0;f!==l;++f){const p=o[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=wy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,o=e._clip.duration,l=o/i,c=i/o;e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,o=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,f=c.sampleValues;return h[0]=o,h[1]=o+n,f[0]=e/l,f[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Ym:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case gf:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),f[p].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,o=this._loopCount;const l=n===Ay;if(e===0)return o===-1?i:l&&(o&1)===1?t-i:i;if(n===Ty){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const f=e<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(l&&(o&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ga,i.endingEnd=ga):(e?i.endingStart=this.zeroSlopeAtStart?ga:ma:i.endingStart=Kl,t?i.endingEnd=this.zeroSlopeAtEnd?ga:ma:i.endingEnd=Kl)}_scheduleFading(e,t,n){const i=this._mixer,o=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const Ww=new Float32Array(1);class Xw extends ys{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,f=this._bindingsByRootAndName;let p=f[h];p===void 0&&(p={},f[h]=p);for(let g=0;g!==o;++g){const m=i[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,h,v));continue}const E=t&&t._propertyBindings[g].binding.parsedPath;_=new Ob(Ut.create(n,v,E),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,h,v),l[g]=_}c[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const nx=new F,ju=new F,Mo=new F,Eo=new F,Hp=new F,Qw=new F,eA=new F;class tA{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){nx.subVectors(e,this.start),ju.subVectors(this.end,this.start);const n=ju.dot(ju);let o=ju.dot(nx)/n;return t&&(o=dt(o,0,1)),o}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Qw,n=eA){const i=10000000000000001e-32;let o,l;const c=this.start,h=e.start,f=this.end,p=e.end;Mo.subVectors(f,c),Eo.subVectors(p,h),Hp.subVectors(c,h);const g=Mo.dot(Mo),m=Eo.dot(Eo),v=Eo.dot(Hp);if(g<=i&&m<=i)return t.copy(c),n.copy(h),t.sub(n),t.dot(t);if(g<=i)o=0,l=v/m,l=dt(l,0,1);else{const _=Mo.dot(Hp);if(m<=i)l=0,o=dt(-_/g,0,1);else{const E=Mo.dot(Eo),b=g*m-E*E;b!==0?o=dt((E*v-_*m)/b,0,1):o=0,l=(E*o+v)/m,l<0?(l=0,o=dt(-_/g,0,1)):l>1&&(l=1,o=dt((E-_)/g,0,1))}}return t.copy(c).addScaledVector(Mo,o),n.copy(h).addScaledVector(Eo,l),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ix=new F;class nA extends Ft{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,h=32;l1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mA extends bs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const o=new ri({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gA{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ef,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,l){return this.currentPath.bezierCurveTo(e,t,n,i,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const M=[];for(let T=0,w=y.length;TNumber.EPSILON){if(z<0&&(U=M[R],I=-I,A=M[P],z=-z),y.yA.y)continue;if(y.y===U.y){if(y.x===U.x)return!0}else{const O=z*(y.x-U.x)-I*(y.y-U.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(y.y!==U.y)continue;if(A.x<=y.x&&y.x<=U.x||U.x<=y.x&&y.x<=A.x)return!0}}return w}const i=ns.isClockWise,o=this.subPaths;if(o.length===0)return[];let l,c,h;const f=[];if(o.length===1)return c=o[0],h=new ba,h.curves=c.curves,f.push(h),f;let p=!i(o[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,E;m[_]=void 0,v[_]=[];for(let y=0,M=o.length;y1){let y=!1,M=0;for(let T=0,w=m.length;T0&&y===!1&&(v=g)}let b;for(let y=0,M=m.length;ye?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function xA(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function yA(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Mm(r,e,t,n){const i=bA(n);switch(t){case Xm:return r*e;case df:return r*e/i.components*i.byteLength;case dc:return r*e/i.components*i.byteLength;case Ma:return r*e*2/i.components*i.byteLength;case pf:return r*e*2/i.components*i.byteLength;case qm:return r*e*3/i.components*i.byteLength;case jn:return r*e*4/i.components*i.byteLength;case mf:return r*e*4/i.components*i.byteLength;case Vl:case Hl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Gl:case Wl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case xh:case bh:return Math.max(r,16)*Math.max(e,8)/4;case _h:case yh:return Math.max(r,8)*Math.max(e,8)/2;case Sh:case Mh:case Th:case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Eh:case Ah:case Ch:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Rh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ih:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ph:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Dh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Nh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Uh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Oh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case zh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case kh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Hh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case qh:case Yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case jh:case Zh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bA(r){switch(r){case ti:case Vm:return{byteLength:1,components:1};case No:case Hm:case _s:return{byteLength:2,components:1};case hf:case ff:return{byteLength:2,components:4};case Oi:case uf:case ii:return{byteLength:4,components:1};case Gm:case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SA{static contain(e,t){return _A(e,t)}static cover(e,t){return xA(e,t)}static fill(e){return yA(e)}static getByteLength(e,t,n,i){return Mm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:of}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=of);function Vb(){let r=null,e=!1,t=null,n=null;function i(o,l){t(o,l),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function MA(r){const e=new WeakMap;function t(c,h){const f=c.array,p=c.usage,g=f.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=r.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=r.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=r.HALF_FLOAT:v=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=r.SHORT;else if(f instanceof Uint32Array)v=r.UNSIGNED_INT;else if(f instanceof Int32Array)v=r.INT;else if(f instanceof Int8Array)v=r.BYTE;else if(f instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,f){const p=h.array,g=h.updateRanges;if(r.bindBuffer(f,c),g.length===0)r.bufferSubData(f,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,kA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,VA=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,HA=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,GA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,WA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,XA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,qA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,YA=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,jA=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,ZA=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,$A=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,JA=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,KA=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,QA=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,eC="gl_FragColor = linearToOutputTexel( gl_FragColor );",tC=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,nC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,iC=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,sC=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,rC=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,aC=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,oC=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,lC=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,cC=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,uC=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,hC=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,fC=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,dC=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,pC=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,mC=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,gC=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,vC=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,_C=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xC=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,yC=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bC=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,SC=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,MC=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,EC=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,TC=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,wC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,AC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,CC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,RC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,IC=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,PC=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,LC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,DC=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,NC=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,UC=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,FC=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,OC=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,BC=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zC=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,kC=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,VC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,HC=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,GC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,WC=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,XC=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,qC=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,YC=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,jC=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,ZC=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,$C=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,JC=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KC=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,QC=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,eR=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,tR=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,nR=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,iR=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,sR=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,rR=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,aR=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oR=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,lR=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,cR=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,uR=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,hR=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,fR=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,dR=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,pR=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,mR=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,gR=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,vR=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,_R=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,xR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,yR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bR=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,SR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const MR=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,ER=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,TR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,wR=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,AR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,CR=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,RR=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,IR=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,PR=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,LR=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,DR=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,NR=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,UR=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,FR=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,OR=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,BR=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,zR=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,kR=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,VR=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,HR=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,GR=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,WR=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,XR=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,qR=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,YR=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,jR=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,ZR=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,$R=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,JR=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,KR=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,QR=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,eI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,tI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,nI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Mt={alphahash_fragment:EA,alphahash_pars_fragment:TA,alphamap_fragment:wA,alphamap_pars_fragment:AA,alphatest_fragment:CA,alphatest_pars_fragment:RA,aomap_fragment:IA,aomap_pars_fragment:PA,batching_pars_vertex:LA,batching_vertex:DA,begin_vertex:NA,beginnormal_vertex:UA,bsdfs:FA,iridescence_fragment:OA,bumpmap_pars_fragment:BA,clipping_planes_fragment:zA,clipping_planes_pars_fragment:kA,clipping_planes_pars_vertex:VA,clipping_planes_vertex:HA,color_fragment:GA,color_pars_fragment:WA,color_pars_vertex:XA,color_vertex:qA,common:YA,cube_uv_reflection_fragment:jA,defaultnormal_vertex:ZA,displacementmap_pars_vertex:$A,displacementmap_vertex:JA,emissivemap_fragment:KA,emissivemap_pars_fragment:QA,colorspace_fragment:eC,colorspace_pars_fragment:tC,envmap_fragment:nC,envmap_common_pars_fragment:iC,envmap_pars_fragment:sC,envmap_pars_vertex:rC,envmap_physical_pars_fragment:gC,envmap_vertex:aC,fog_vertex:oC,fog_pars_vertex:lC,fog_fragment:cC,fog_pars_fragment:uC,gradientmap_pars_fragment:hC,lightmap_pars_fragment:fC,lights_lambert_fragment:dC,lights_lambert_pars_fragment:pC,lights_pars_begin:mC,lights_toon_fragment:vC,lights_toon_pars_fragment:_C,lights_phong_fragment:xC,lights_phong_pars_fragment:yC,lights_physical_fragment:bC,lights_physical_pars_fragment:SC,lights_fragment_begin:MC,lights_fragment_maps:EC,lights_fragment_end:TC,logdepthbuf_fragment:wC,logdepthbuf_pars_fragment:AC,logdepthbuf_pars_vertex:CC,logdepthbuf_vertex:RC,map_fragment:IC,map_pars_fragment:PC,map_particle_fragment:LC,map_particle_pars_fragment:DC,metalnessmap_fragment:NC,metalnessmap_pars_fragment:UC,morphinstance_vertex:FC,morphcolor_vertex:OC,morphnormal_vertex:BC,morphtarget_pars_vertex:zC,morphtarget_vertex:kC,normal_fragment_begin:VC,normal_fragment_maps:HC,normal_pars_fragment:GC,normal_pars_vertex:WC,normal_vertex:XC,normalmap_pars_fragment:qC,clearcoat_normal_fragment_begin:YC,clearcoat_normal_fragment_maps:jC,clearcoat_pars_fragment:ZC,iridescence_pars_fragment:$C,opaque_fragment:JC,packing:KC,premultiplied_alpha_fragment:QC,project_vertex:eR,dithering_fragment:tR,dithering_pars_fragment:nR,roughnessmap_fragment:iR,roughnessmap_pars_fragment:sR,shadowmap_pars_fragment:rR,shadowmap_pars_vertex:aR,shadowmap_vertex:oR,shadowmask_pars_fragment:lR,skinbase_vertex:cR,skinning_pars_vertex:uR,skinning_vertex:hR,skinnormal_vertex:fR,specularmap_fragment:dR,specularmap_pars_fragment:pR,tonemapping_fragment:mR,tonemapping_pars_fragment:gR,transmission_fragment:vR,transmission_pars_fragment:_R,uv_pars_fragment:xR,uv_pars_vertex:yR,uv_vertex:bR,worldpos_vertex:SR,background_vert:MR,background_frag:ER,backgroundCube_vert:TR,backgroundCube_frag:wR,cube_vert:AR,cube_frag:CR,depth_vert:RR,depth_frag:IR,distance_vert:PR,distance_frag:LR,equirect_vert:DR,equirect_frag:NR,linedashed_vert:UR,linedashed_frag:FR,meshbasic_vert:OR,meshbasic_frag:BR,meshlambert_vert:zR,meshlambert_frag:kR,meshmatcap_vert:VR,meshmatcap_frag:HR,meshnormal_vert:GR,meshnormal_frag:WR,meshphong_vert:XR,meshphong_frag:qR,meshphysical_vert:YR,meshphysical_frag:jR,meshtoon_vert:ZR,meshtoon_frag:$R,points_vert:JR,points_frag:KR,shadow_vert:QR,shadow_frag:eI,sprite_vert:tI,sprite_frag:nI},Ge={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ts={basic:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Qn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Qn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Qn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Qn([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Qn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Qn([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Qn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Qn([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distance:{uniforms:Qn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distance_vert,fragmentShader:Mt.distance_frag},shadow:{uniforms:Qn([Ge.lights,Ge.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};ts.physical={uniforms:Qn([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const eh={r:0,b:0,g:0},la=new Ii,iI=new mt;function sI(r,e,t,n,i,o){const l=new Xe(0);let c=i===!0?0:1,h,f,p=null,g=0,m=null;function v(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){const w=M.backgroundBlurriness>0;T=e.get(T,w)}return T}function _(M){let T=!1;const w=v(M);w===null?b(l,c):w&&w.isColor&&(b(w,1),T=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?t.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function E(M,T){const w=v(T);w&&(w.isCubeTexture||w.mapping===Go)?(f===void 0&&(f=new bn(new Ra(1,1,1),new Bi({name:"BackgroundCubeMaterial",uniforms:Vo(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),la.copy(T.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=w,f.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(iI.makeRotationFromEuler(la)),f.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,(p!==w||g!==w.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null)):w&&w.isTexture&&(h===void 0&&(h=new bn(new Xo(2,2),new Bi({name:"BackgroundMaterial",uniforms:Vo(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:Xs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=w,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(w.colorSpace)!==Wt,w.matrixAutoUpdate===!0&&w.updateMatrix(),h.material.uniforms.uvTransform.value.copy(w.matrix),(p!==w||g!==w.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,p=w,g=w.version,m=r.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,T){M.getRGB(eh,cb(r)),t.buffers.color.setClear(eh.r,eh.g,eh.b,T,o)}function y(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,T=1){l.set(M),c=T,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:_,addToRenderList:E,dispose:y}}function rI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,l=!1;function c(O,X,G,j,q){let $=!1;const J=g(O,j,G,X);o!==J&&(o=J,f(o.object)),$=v(O,j,G,q),$&&_(O,j,G,q),q!==null&&e.update(q,r.ELEMENT_ARRAY_BUFFER),($||l)&&(l=!1,w(O,X,G,j),q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return r.createVertexArray()}function f(O){return r.bindVertexArray(O)}function p(O){return r.deleteVertexArray(O)}function g(O,X,G,j){const q=j.wireframe===!0;let $=n[X.id];$===void 0&&($={},n[X.id]=$);const J=O.isInstancedMesh===!0?O.id:0;let pe=$[J];pe===void 0&&(pe={},$[J]=pe);let ce=pe[G.id];ce===void 0&&(ce={},pe[G.id]=ce);let Ee=ce[q];return Ee===void 0&&(Ee=m(h()),ce[q]=Ee),Ee}function m(O){const X=[],G=[],j=[];for(let q=0;q=0){const me=q[ce];let _e=$[ce];if(_e===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),me===void 0||me.attribute!==_e||_e&&me.data!==_e.data)return!0;J++}return o.attributesNum!==J||o.index!==j}function _(O,X,G,j){const q={},$=X.attributes;let J=0;const pe=G.getAttributes();for(const ce in pe)if(pe[ce].location>=0){let me=$[ce];me===void 0&&(ce==="instanceMatrix"&&O.instanceMatrix&&(me=O.instanceMatrix),ce==="instanceColor"&&O.instanceColor&&(me=O.instanceColor));const _e={};_e.attribute=me,me&&me.data&&(_e.data=me.data),q[ce]=_e,J++}o.attributes=q,o.attributesNum=J,o.index=j}function E(){const O=o.newAttributes;for(let X=0,G=O.length;X=0){let Ee=q[pe];if(Ee===void 0&&(pe==="instanceMatrix"&&O.instanceMatrix&&(Ee=O.instanceMatrix),pe==="instanceColor"&&O.instanceColor&&(Ee=O.instanceColor)),Ee!==void 0){const me=Ee.normalized,_e=Ee.itemSize,qe=e.get(Ee);if(qe===void 0)continue;const ot=qe.buffer,Tt=qe.type,le=qe.bytesPerElement,Ae=Tt===r.INT||Tt===r.UNSIGNED_INT||Ee.gpuType===uf;if(Ee.isInterleavedBufferAttribute){const Ce=Ee.data,$e=Ce.stride,et=Ee.offset;if(Ce.isInstancedInterleavedBuffer){for(let lt=0;lt0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=t.precision!==void 0?t.precision:"highp";const p=h(f);p!==f&&(ke("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);const g=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),y=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),T=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),R=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,reversedDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:E,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:w,maxSamples:P,samples:R}}function lI(r){const e=this;let t=null,n=0,i=!1,o=!1;const l=new ks,c=new xt,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||n!==0||i;return i=m,n=g.length,v},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,E=g.clipIntersection,b=g.clipShadows,y=r.get(g);if(!i||_===null||_.length===0||o&&!b)o?p(null):f();else{const M=o?0:n,T=M*4;let w=y.clippingState||null;h.value=w,w=p(_,m,T,v);for(let P=0;P!==T;++P)w[P]=t[P];y.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=M}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,m,v,_){const E=g!==null?g.length:0;let b=null;if(E!==0){if(b=h.value,_!==!0||b===null){const y=v+E*4,M=m.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),g.setRenderTarget(i),y&&g.render(E,h),g.render(e,h)}g.toneMapping=v,g.autoClear=m,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===vs||e.mapping===Mr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fx());const o=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=o;const c=o.uniforms;c.envMap.value=e;const h=this._cubeSize;To(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(l,Ll)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let o=1;o_-Sr?n-_+Sr:0),y=4*(this._cubeSize-E);h.envMap.value=e.texture,h.roughness.value=v,h.mipInt.value=_-t,To(o,b,y,3*E,2*E),i.setRenderTarget(o),i.render(c,Ll),h.envMap.value=o.texture,h.roughness.value=0,h.mipInt.value=_-n,To(e,b,y,3*E,2*E),i.setRenderTarget(e),i.render(c,Ll)}_blur(e,t,n,i,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",o),this._halfBlur(l,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,l,c){const h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&it("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=f;const m=f.uniforms,v=this._sizeLods[n]-1,_=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*da-1),E=o/_,b=isFinite(o)?1+Math.floor(p*E):da;b>da&&ke(`sigmaRadians, ${o}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${da}`);const y=[];let M=0;for(let U=0;UT-Sr?i-T+Sr:0),R=4*(this._cubeSize-w);To(t,P,R,3*w,2*w),h.setRenderTarget(t),h.render(g,Ll)}}function hI(r){const e=[],t=[],n=[];let i=r;const o=r-Sr+1+cx.length;for(let l=0;lr-Sr?h=cx[l-r+Sr-1]:l===0&&(h=0),t.push(h);const f=1/(c-2),p=-f,g=1+f,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,E=3,b=2,y=1,M=new Float32Array(E*_*v),T=new Float32Array(b*_*v),w=new Float32Array(y*_*v);for(let R=0;R2?0:-1,I=[U,A,0,U+2/3,A,0,U+2/3,A+1,0,U,A,0,U+2/3,A+1,0,U,A+1,0];M.set(I,E*_*R),T.set(m,b*_*R);const z=[R,R,R,R,R,R];w.set(z,y*_*R)}const P=new vt;P.setAttribute("position",new Yt(M,E)),P.setAttribute("uv",new Yt(T,b)),P.setAttribute("faceIndex",new Yt(w,y)),n.push(new bn(P,null)),i>Sr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hx(r,e,t){const n=new Ri(r,e,t);return n.texture.mapping=Go,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function To(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function fI(r,e,t){return new Bi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:cI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Hf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dI(r,e,t){const n=new Float32Array(da),i=new F(0,1,0);return new Bi({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function fx(){return new Bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function dx(){return new Bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Hf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:gs,depthTest:!1,depthWrite:!1})}function Hf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Tg extends Ri{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new pc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Ra(5,5,5),o=new Bi({name:"CubemapFromEquirect",uniforms:Vo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:gs});o.uniforms.tEquirect.value=t;const l=new bn(i,o),c=t.minFilter;return t.minFilter===ps&&(t.minFilter=Qt),new Db(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(o)}}function pI(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,v=!1){return m==null?null:v?l(m):o(m)}function o(m){if(m&&m.isTexture){const v=m.mapping;if(v===Bl||v===zl)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const E=new Tg(_.height);return E.fromEquirectangularTexture(r,m),e.set(m,E),m.addEventListener("dispose",f),c(E.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const v=m.mapping,_=v===Bl||v===zl,E=v===vs||v===Mr;if(_||E){let b=t.get(m);const y=b!==void 0?b.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m,b):n.fromCubemap(m,b),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),b.texture;if(b!==void 0)return b.texture;{const M=m.image;return _&&M&&M.height>0||E&&M&&h(M)?(n===null&&(n=new Em(r)),b=_?n.fromEquirectangular(m):n.fromCubemap(m),b.texture.pmremVersion=m.pmremVersion,t.set(m,b),m.addEventListener("dispose",p),b.texture):null}}}return m}function c(m,v){return v===Bl?m.mapping=vs:v===zl&&(m.mapping=Mr),m}function h(m){let v=0;const _=6;for(let E=0;E<_;E++)m[E]!==void 0&&v++;return v===_}function f(m){const v=m.target;v.removeEventListener("dispose",f);const _=e.get(v);_!==void 0&&(e.delete(v),_.dispose())}function p(m){const v=m.target;v.removeEventListener("dispose",p);const _=t.get(v);_!==void 0&&(t.delete(v),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:g}}function mI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ic("WebGLRenderer: "+n+" extension not supported."),i}}}function gI(r,e,t,n){const i={},o=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(g,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function h(g){const m=g.attributes;for(const v in m)e.update(m[v],r.ARRAY_BUFFER)}function f(g){const m=[],v=g.index,_=g.attributes.position;let E=0;if(_===void 0)return;if(v!==null){const M=v.array;E=v.version;for(let T=0,w=M.length;T=65535?Km:Jm)(m,1);b.version=E;const y=o.get(g);y&&e.remove(y),o.set(g,b)}function p(g){const m=o.get(g);if(m){const v=g.index;v!==null&&m.versione.maxTextureSize&&(P=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const R=new Float32Array(w*P*4*g),U=new xf(R,w,P,g);U.type=ii,U.needsUpdate=!0;const A=T*4;for(let z=0;z + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),f=new bn(c,h),p=new Ws(-1,1,1,-1,0,1);let g=null,m=null,v=!1,_,E=null,b=[],y=!1;this.setSize=function(M,T){o.setSize(M,T),l.setSize(M,T);for(let w=0;w0&&b[0].isRenderPass===!0;const T=o.width,w=o.height;for(let P=0;P0)return r;const i=e*t;let o=px[i];if(o===void 0&&(o=new Float32Array(i),px[i]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,r[l].toArray(o,c)}return o}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0&&(this.seq=i.concat(o))}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function yx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const d3=37297;let p3=0;function m3(r,e){const t=r.split(` +`),n=[],i=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=i;l":" "} ${c}: ${t[l]}`)}return n.join(` +`)}const bx=new xt;function g3(r){Dt._getMatrix(bx,Dt.workingColorSpace,r);const e=`mat3( ${bx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case Wt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Sx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),o=(r.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+` + +`+o+` + +`+m3(r.getShaderSource(e),c)}else return o}function v3(r,e){const t=g3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const _3={[Nm]:"Linear",[Um]:"Reinhard",[Fm]:"Cineon",[lf]:"ACESFilmic",[Bm]:"AgX",[zm]:"Neutral",[Om]:"Custom"};function x3(r,e){const t=_3[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const th=new F;function y3(){Dt.getLuminanceCoefficients(th);const r=th.x.toFixed(4),e=th.y.toFixed(4),t=th.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function b3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(` +`)}function S3(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function M3(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function wm(r){return r.replace(E3,w3)}const T3=new Map;function w3(r,e){let t=Mt[e];if(t===void 0){const n=T3.get(e);if(n!==void 0)t=Mt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return wm(t)}const A3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Tx(r){return r.replace(A3,C3)}function C3(r,e,t,n){let i="";for(let o=parseInt(e);o0&&(b+=` +`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fl).join(` +`),y.length>0&&(y+=` +`)):(b=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Fl).join(` +`),y=[wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?Mt.tonemapping_pars_fragment:"",t.toneMapping!==Fi?x3("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,v3("linearToOutputTexel",t.outputColorSpace),y3(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Fl).join(` +`)),l=wm(l),l=Mx(l,t),l=Ex(l,t),c=wm(c),c=Mx(c,t),c=Ex(c,t),l=Tx(l),c=Tx(c),t.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+b,y=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+y);const T=M+b+l,w=M+y+c,P=yx(i,i.VERTEX_SHADER,T),R=yx(i,i.FRAGMENT_SHADER,w);i.attachShader(E,P),i.attachShader(E,R),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function U(O){if(r.debug.checkShaderErrors){const X=i.getProgramInfoLog(E)||"",G=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(R)||"",q=X.trim(),$=G.trim(),J=j.trim();let pe=!0,ce=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(pe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,E,P,R);else{const Ee=Sx(i,P,"vertex"),me=Sx(i,R,"fragment");it("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` + +Material Name: `+O.name+` +Material Type: `+O.type+` + +Program Info Log: `+q+` +`+Ee+` +`+me)}else q!==""?ke("WebGLProgram: Program Info Log:",q):($===""||J==="")&&(ce=!1);ce&&(O.diagnostics={runnable:pe,programLog:q,vertexShader:{log:$,prefix:b},fragmentShader:{log:J,prefix:y}})}i.deleteShader(P),i.deleteShader(R),A=new oh(i,E),I=M3(i,E)}let A;this.getUniforms=function(){return A===void 0&&U(this),A};let I;this.getAttributes=function(){return I===void 0&&U(this),I};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(E,d3)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=p3++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=R,this}let z3=0;class k3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new V3(e),t.set(e,n)),n}}class V3{constructor(e){this.id=z3++,this.code=e,this.usedTimes=0}}function H3(r,e,t,n,i,o){const l=new Oo,c=new k3,h=new Set,f=[],p=new Map,g=n.logarithmicDepthBuffer;let m=n.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(A){return h.add(A),A===0?"uv":`uv${A}`}function E(A,I,z,O,X){const G=O.fog,j=X.geometry,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?O.environment:null,$=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,J=e.get(A.envMap||q,$),pe=J&&J.mapping===Go?J.image.height:null,ce=v[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const Ee=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,me=Ee!==void 0?Ee.length:0;let _e=0;j.morphAttributes.position!==void 0&&(_e=1),j.morphAttributes.normal!==void 0&&(_e=2),j.morphAttributes.color!==void 0&&(_e=3);let qe,ot,Tt,le;if(ce){const At=ts[ce];qe=At.vertexShader,ot=At.fragmentShader}else qe=A.vertexShader,ot=A.fragmentShader,c.update(A),Tt=c.getVertexShaderID(A),le=c.getFragmentShaderID(A);const Ae=r.getRenderTarget(),Ce=r.state.buffers.depth.getReversed(),$e=X.isInstancedMesh===!0,et=X.isBatchedMesh===!0,lt=!!A.map,wt=!!A.matcap,at=!!J,de=!!A.aoMap,xe=!!A.lightMap,fe=!!A.bumpMap,Pe=!!A.normalMap,B=!!A.displacementMap,Qe=!!A.emissiveMap,Oe=!!A.metalnessMap,nt=!!A.roughnessMap,Me=A.anisotropy>0,N=A.clearcoat>0,C=A.dispersion>0,W=A.iridescence>0,se=A.sheen>0,he=A.transmission>0,re=Me&&!!A.anisotropyMap,He=N&&!!A.clearcoatMap,Te=N&&!!A.clearcoatNormalMap,Je=N&&!!A.clearcoatRoughnessMap,rt=W&&!!A.iridescenceMap,ye=W&&!!A.iridescenceThicknessMap,we=se&&!!A.sheenColorMap,Ye=se&&!!A.sheenRoughnessMap,k=!!A.specularMap,te=!!A.specularColorMap,Le=!!A.specularIntensityMap,V=he&&!!A.transmissionMap,ve=he&&!!A.thicknessMap,be=!!A.gradientMap,Be=!!A.alphaMap,Se=A.alphaTest>0,oe=!!A.alphaHash,We=!!A.extensions;let st=Fi;A.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(st=r.toneMapping);const Et={shaderID:ce,shaderType:A.type,shaderName:A.name,vertexShader:qe,fragmentShader:ot,defines:A.defines,customVertexShaderID:Tt,customFragmentShaderID:le,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:et,batchingColor:et&&X._colorsTexture!==null,instancing:$e,instancingColor:$e&&X.instanceColor!==null,instancingMorph:$e&&X.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:Er,alphaToCoverage:!!A.alphaToCoverage,map:lt,matcap:wt,envMap:at,envMapMode:at&&J.mapping,envMapCubeUVHeight:pe,aoMap:de,lightMap:xe,bumpMap:fe,normalMap:Pe,displacementMap:B,emissiveMap:Qe,normalMapObjectSpace:Pe&&A.normalMapType===Ry,normalMapTangentSpace:Pe&&A.normalMapType===Ar,metalnessMap:Oe,roughnessMap:nt,anisotropy:Me,anisotropyMap:re,clearcoat:N,clearcoatMap:He,clearcoatNormalMap:Te,clearcoatRoughnessMap:Je,dispersion:C,iridescence:W,iridescenceMap:rt,iridescenceThicknessMap:ye,sheen:se,sheenColorMap:we,sheenRoughnessMap:Ye,specularMap:k,specularColorMap:te,specularIntensityMap:Le,transmission:he,transmissionMap:V,thicknessMap:ve,gradientMap:be,opaque:A.transparent===!1&&A.blending===xa&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Se,alphaHash:oe,combine:A.combine,mapUv:lt&&_(A.map.channel),aoMapUv:de&&_(A.aoMap.channel),lightMapUv:xe&&_(A.lightMap.channel),bumpMapUv:fe&&_(A.bumpMap.channel),normalMapUv:Pe&&_(A.normalMap.channel),displacementMapUv:B&&_(A.displacementMap.channel),emissiveMapUv:Qe&&_(A.emissiveMap.channel),metalnessMapUv:Oe&&_(A.metalnessMap.channel),roughnessMapUv:nt&&_(A.roughnessMap.channel),anisotropyMapUv:re&&_(A.anisotropyMap.channel),clearcoatMapUv:He&&_(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Je&&_(A.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&_(A.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&_(A.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(A.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&_(A.sheenRoughnessMap.channel),specularMapUv:k&&_(A.specularMap.channel),specularColorMapUv:te&&_(A.specularColorMap.channel),specularIntensityMapUv:Le&&_(A.specularIntensityMap.channel),transmissionMapUv:V&&_(A.transmissionMap.channel),thicknessMapUv:ve&&_(A.thicknessMap.channel),alphaMapUv:Be&&_(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Pe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!j.attributes.uv&&(lt||Be),fog:!!G,useFog:A.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Pe===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:X.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:_e,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:st,decodeVideoTexture:lt&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Wt,decodeVideoTextureEmissive:Qe&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ds,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||et)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Et.vertexUv1s=h.has(1),Et.vertexUv2s=h.has(2),Et.vertexUv3s=h.has(3),h.clear(),Et}function b(A){const I=[];if(A.shaderID?I.push(A.shaderID):(I.push(A.customVertexShaderID),I.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)I.push(z),I.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(y(I,A),M(I,A),I.push(r.outputColorSpace)),I.push(A.customProgramCacheKey),I.join()}function y(A,I){A.push(I.precision),A.push(I.outputColorSpace),A.push(I.envMapMode),A.push(I.envMapCubeUVHeight),A.push(I.mapUv),A.push(I.alphaMapUv),A.push(I.lightMapUv),A.push(I.aoMapUv),A.push(I.bumpMapUv),A.push(I.normalMapUv),A.push(I.displacementMapUv),A.push(I.emissiveMapUv),A.push(I.metalnessMapUv),A.push(I.roughnessMapUv),A.push(I.anisotropyMapUv),A.push(I.clearcoatMapUv),A.push(I.clearcoatNormalMapUv),A.push(I.clearcoatRoughnessMapUv),A.push(I.iridescenceMapUv),A.push(I.iridescenceThicknessMapUv),A.push(I.sheenColorMapUv),A.push(I.sheenRoughnessMapUv),A.push(I.specularMapUv),A.push(I.specularColorMapUv),A.push(I.specularIntensityMapUv),A.push(I.transmissionMapUv),A.push(I.thicknessMapUv),A.push(I.combine),A.push(I.fogExp2),A.push(I.sizeAttenuation),A.push(I.morphTargetsCount),A.push(I.morphAttributeCount),A.push(I.numDirLights),A.push(I.numPointLights),A.push(I.numSpotLights),A.push(I.numSpotLightMaps),A.push(I.numHemiLights),A.push(I.numRectAreaLights),A.push(I.numDirLightShadows),A.push(I.numPointLightShadows),A.push(I.numSpotLightShadows),A.push(I.numSpotLightShadowsWithMaps),A.push(I.numLightProbes),A.push(I.shadowMapType),A.push(I.toneMapping),A.push(I.numClippingPlanes),A.push(I.numClipIntersection),A.push(I.depthPacking)}function M(A,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),A.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),A.push(l.mask)}function T(A){const I=v[A.type];let z;if(I){const O=ts[I];z=ub.clone(O.uniforms)}else z=A.uniforms;return z}function w(A,I){let z=p.get(I);return z!==void 0?++z.usedTimes:(z=new B3(r,I,A,i),f.push(z),p.set(I,z)),z}function P(A){if(--A.usedTimes===0){const I=f.indexOf(A);f[I]=f[f.length-1],f.pop(),p.delete(A.cacheKey),A.destroy()}}function R(A){c.remove(A)}function U(){c.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:T,acquireProgram:w,releaseProgram:P,releaseShaderCache:R,programs:f,dispose:U}}function G3(){let r=new WeakMap;function e(l){return r.has(l)}function t(l){let c=r.get(l);return c===void 0&&(c={},r.set(l,c)),c}function n(l){r.delete(l)}function i(l,c,h){r.get(l)[c]=h}function o(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:o}}function W3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Ax(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Cx(){const r=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let v=0;return m.isInstancedMesh&&(v+=2),m.isSkinnedMesh&&(v+=1),v}function c(m,v,_,E,b,y){let M=r[e];return M===void 0?(M={id:m.id,object:m,geometry:v,material:_,materialVariant:l(m),groupOrder:E,renderOrder:m.renderOrder,z:b,group:y},r[e]=M):(M.id=m.id,M.object=m,M.geometry=v,M.material=_,M.materialVariant=l(m),M.groupOrder=E,M.renderOrder=m.renderOrder,M.z=b,M.group=y),e++,M}function h(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.push(M):_.transparent===!0?i.push(M):t.push(M)}function f(m,v,_,E,b,y){const M=c(m,v,_,E,b,y);_.transmission>0?n.unshift(M):_.transparent===!0?i.unshift(M):t.unshift(M)}function p(m,v){t.length>1&&t.sort(m||W3),n.length>1&&n.sort(v||Ax),i.length>1&&i.sort(v||Ax)}function g(){for(let m=e,v=r.length;m=o.length?(l=new Cx,o.push(l)):l=o[i],l}function t(){r=new WeakMap}return{get:e,dispose:t}}function q3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Xe};break;case"SpotLight":t={position:new F,direction:new F,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Y3(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let j3=0;function Z3(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $3(r){const e=new q3,t=Y3(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new F);const i=new F,o=new mt,l=new mt;function c(f){let p=0,g=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let v=0,_=0,E=0,b=0,y=0,M=0,T=0,w=0,P=0,R=0,U=0;f.sort(Z3);for(let I=0,z=f.length;I0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==v||A.pointLength!==_||A.spotLength!==E||A.rectAreaLength!==b||A.hemiLength!==y||A.numDirectionalShadows!==M||A.numPointShadows!==T||A.numSpotShadows!==w||A.numSpotMaps!==P||A.numLightProbes!==U)&&(n.directional.length=v,n.spot.length=E,n.rectArea.length=b,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=w+P-R,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=U,A.directionalLength=v,A.pointLength=_,A.spotLength=E,A.rectAreaLength=b,A.hemiLength=y,A.numDirectionalShadows=M,A.numPointShadows=T,A.numSpotShadows=w,A.numSpotMaps=P,A.numLightProbes=U,n.version=j3++)}function h(f,p){let g=0,m=0,v=0,_=0,E=0;const b=p.matrixWorldInverse;for(let y=0,M=f.length;y=l.length?(c=new Rx(r),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const K3=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Q3=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,eP=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],tP=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],Ix=new mt,Dl=new F,$p=new F;function nP(r,e,t){let n=new Wo;const i=new ue,o=new ue,l=new Zt,c=new hg,h=new fg,f={},p=t.maxTextureSize,g={[Xs]:si,[si]:Xs,[ds]:ds},m=new Bi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:K3,fragmentShader:Q3}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new vt;_.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new bn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Lo;let y=this.type;this.render=function(R,U,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;this.type===Ol&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Lo);const I=r.getRenderTarget(),z=r.getActiveCubeFace(),O=r.getActiveMipmapLevel(),X=r.state;X.setBlending(gs),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const G=y!==this.type;G&&U.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(q=>q.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,q=R.length;jp||i.y>p)&&(i.x>p&&(o.x=Math.floor(p/pe.x),i.x=o.x*pe.x,J.mapSize.x=o.x),i.y>p&&(o.y=Math.floor(p/pe.y),i.y=o.y*pe.y,J.mapSize.y=o.y));const ce=r.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===pa){if($.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ri(i.x,i.y,{format:Ma,type:_s,minFilter:Qt,magFilter:Qt,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new zo(i.x,i.y,ii),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=xs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn}else $.isPointLight?(J.map=new Tg(i.x),J.map.depthTexture=new $y(i.x,Oi)):(J.map=new Ri(i.x,i.y),J.map.depthTexture=new zo(i.x,i.y,Oi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=xs,this.type===Lo?(J.map.depthTexture.compareFunction=ce?_f:vf,J.map.depthTexture.minFilter=Qt,J.map.depthTexture.magFilter=Qt):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=pn,J.map.depthTexture.magFilter=pn);J.camera.updateProjectionMatrix()}const Ee=J.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||U.map&&U.alphaTest>0||U.alphaToCoverage===!0){const X=z.uuid,G=U.uuid;let j=f[X];j===void 0&&(j={},f[X]=j);let q=j[G];q===void 0&&(q=z.clone(),j[G]=q,U.addEventListener("dispose",P)),z=q}if(z.visible=U.visible,z.wireframe=U.wireframe,I===pa?z.side=U.shadowSide!==null?U.shadowSide:U.side:z.side=U.shadowSide!==null?U.shadowSide:g[U.side],z.alphaMap=U.alphaMap,z.alphaTest=U.alphaToCoverage===!0?.5:U.alphaTest,z.map=U.map,z.clipShadows=U.clipShadows,z.clippingPlanes=U.clippingPlanes,z.clipIntersection=U.clipIntersection,z.displacementMap=U.displacementMap,z.displacementScale=U.displacementScale,z.displacementBias=U.displacementBias,z.wireframeLinewidth=U.wireframeLinewidth,z.linewidth=U.linewidth,A.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const X=r.properties.get(z);X.light=A}return z}function w(R,U,A,I,z){if(R.visible===!1)return;if(R.layers.test(U.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&z===pa)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const G=e.update(R),j=R.material;if(Array.isArray(j)){const q=G.groups;for(let $=0,J=q.length;$=1):pe.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),$=J>=2);let ce=null,Ee={};const me=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),qe=new Zt().fromArray(me),ot=new Zt().fromArray(_e);function Tt(V,ve,be,Be){const Se=new Uint8Array(4),oe=r.createTexture();r.bindTexture(V,oe),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ue,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,C){return v?new OffscreenCanvas(N,C):tc("canvas")}function E(N,C,W){let se=1;const he=Me(N);if((he.width>W||he.height>W)&&(se=W/Math.max(he.width,he.height)),se<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const re=Math.floor(se*he.width),He=Math.floor(se*he.height);g===void 0&&(g=_(re,He));const Te=C?_(re,He):g;return Te.width=re,Te.height=He,Te.getContext("2d").drawImage(N,0,0,re,He),ke("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+re+"x"+He+")."),Te}else return"data"in N&&ke("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),N;return N}function b(N){return N.generateMipmaps}function y(N){r.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?r.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function T(N,C,W,se,he=!1){if(N!==null){if(r[N]!==void 0)return r[N];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=C;if(C===r.RED&&(W===r.FLOAT&&(re=r.R32F),W===r.HALF_FLOAT&&(re=r.R16F),W===r.UNSIGNED_BYTE&&(re=r.R8)),C===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.R8UI),W===r.UNSIGNED_SHORT&&(re=r.R16UI),W===r.UNSIGNED_INT&&(re=r.R32UI),W===r.BYTE&&(re=r.R8I),W===r.SHORT&&(re=r.R16I),W===r.INT&&(re=r.R32I)),C===r.RG&&(W===r.FLOAT&&(re=r.RG32F),W===r.HALF_FLOAT&&(re=r.RG16F),W===r.UNSIGNED_BYTE&&(re=r.RG8)),C===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RG8UI),W===r.UNSIGNED_SHORT&&(re=r.RG16UI),W===r.UNSIGNED_INT&&(re=r.RG32UI),W===r.BYTE&&(re=r.RG8I),W===r.SHORT&&(re=r.RG16I),W===r.INT&&(re=r.RG32I)),C===r.RGB_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGB8UI),W===r.UNSIGNED_SHORT&&(re=r.RGB16UI),W===r.UNSIGNED_INT&&(re=r.RGB32UI),W===r.BYTE&&(re=r.RGB8I),W===r.SHORT&&(re=r.RGB16I),W===r.INT&&(re=r.RGB32I)),C===r.RGBA_INTEGER&&(W===r.UNSIGNED_BYTE&&(re=r.RGBA8UI),W===r.UNSIGNED_SHORT&&(re=r.RGBA16UI),W===r.UNSIGNED_INT&&(re=r.RGBA32UI),W===r.BYTE&&(re=r.RGBA8I),W===r.SHORT&&(re=r.RGBA16I),W===r.INT&&(re=r.RGBA32I)),C===r.RGB&&(W===r.UNSIGNED_INT_5_9_9_9_REV&&(re=r.RGB9_E5),W===r.UNSIGNED_INT_10F_11F_11F_REV&&(re=r.R11F_G11F_B10F)),C===r.RGBA){const He=he?Ql:Dt.getTransfer(se);W===r.FLOAT&&(re=r.RGBA32F),W===r.HALF_FLOAT&&(re=r.RGBA16F),W===r.UNSIGNED_BYTE&&(re=He===Wt?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(re=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(re=r.RGB5_A1)}return(re===r.R16F||re===r.R32F||re===r.RG16F||re===r.RG32F||re===r.RGBA16F||re===r.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(N,C){let W;return N?C===null||C===Oi||C===Uo?W=r.DEPTH24_STENCIL8:C===ii?W=r.DEPTH32F_STENCIL8:C===No&&(W=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Oi||C===Uo?W=r.DEPTH_COMPONENT24:C===ii?W=r.DEPTH_COMPONENT32F:C===No&&(W=r.DEPTH_COMPONENT16),W}function P(N,C){return b(N)===!0||N.isFramebufferTexture&&N.minFilter!==pn&&N.minFilter!==Qt?Math.log2(Math.max(C.width,C.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?C.mipmaps.length:1}function R(N){const C=N.target;C.removeEventListener("dispose",R),A(C),C.isVideoTexture&&p.delete(C)}function U(N){const C=N.target;C.removeEventListener("dispose",U),z(C)}function A(N){const C=n.get(N);if(C.__webglInit===void 0)return;const W=N.source,se=m.get(W);if(se){const he=se[C.__cacheKey];he.usedTimes--,he.usedTimes===0&&I(N),Object.keys(se).length===0&&m.delete(W)}n.remove(N)}function I(N){const C=n.get(N);r.deleteTexture(C.__webglTexture);const W=N.source,se=m.get(W);delete se[C.__cacheKey],l.memory.textures--}function z(N){const C=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(C.__webglFramebuffer[se]))for(let he=0;he=i.maxTextures&&ke("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),O+=1,N}function j(N){const C=[];return C.push(N.wrapS),C.push(N.wrapT),C.push(N.wrapR||0),C.push(N.magFilter),C.push(N.minFilter),C.push(N.anisotropy),C.push(N.internalFormat),C.push(N.format),C.push(N.type),C.push(N.generateMipmaps),C.push(N.premultiplyAlpha),C.push(N.flipY),C.push(N.unpackAlignment),C.push(N.colorSpace),C.join()}function q(N,C){const W=n.get(N);if(N.isVideoTexture&&Oe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&W.__version!==N.version){const se=N.image;if(se===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,N,C);return}}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+C)}function $(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}else N.isExternalTexture&&(W.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+C)}function J(N,C){const W=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&W.__version!==N.version){le(W,N,C);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+C)}function pe(N,C){const W=n.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&W.__version!==N.version){Ae(W,N,C);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+C)}const ce={[Zl]:r.REPEAT,[pi]:r.CLAMP_TO_EDGE,[$l]:r.MIRRORED_REPEAT},Ee={[pn]:r.NEAREST,[km]:r.NEAREST_MIPMAP_NEAREST,[Ro]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[kl]:r.LINEAR_MIPMAP_NEAREST,[ps]:r.LINEAR_MIPMAP_LINEAR},me={[Iy]:r.NEVER,[Uy]:r.ALWAYS,[Py]:r.LESS,[vf]:r.LEQUAL,[Ly]:r.EQUAL,[_f]:r.GEQUAL,[Dy]:r.GREATER,[Ny]:r.NOTEQUAL};function _e(N,C){if(C.type===ii&&e.has("OES_texture_float_linear")===!1&&(C.magFilter===Qt||C.magFilter===kl||C.magFilter===Ro||C.magFilter===ps||C.minFilter===Qt||C.minFilter===kl||C.minFilter===Ro||C.minFilter===ps)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(N,r.TEXTURE_WRAP_S,ce[C.wrapS]),r.texParameteri(N,r.TEXTURE_WRAP_T,ce[C.wrapT]),(N===r.TEXTURE_3D||N===r.TEXTURE_2D_ARRAY)&&r.texParameteri(N,r.TEXTURE_WRAP_R,ce[C.wrapR]),r.texParameteri(N,r.TEXTURE_MAG_FILTER,Ee[C.magFilter]),r.texParameteri(N,r.TEXTURE_MIN_FILTER,Ee[C.minFilter]),C.compareFunction&&(r.texParameteri(N,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(N,r.TEXTURE_COMPARE_FUNC,me[C.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===pn||C.minFilter!==Ro&&C.minFilter!==ps||C.type===ii&&e.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(N,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function qe(N,C){let W=!1;N.__webglInit===void 0&&(N.__webglInit=!0,C.addEventListener("dispose",R));const se=C.source;let he=m.get(se);he===void 0&&(he={},m.set(se,he));const re=j(C);if(re!==N.__cacheKey){he[re]===void 0&&(he[re]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,W=!0),he[re].usedTimes++;const He=he[N.__cacheKey];He!==void 0&&(he[N.__cacheKey].usedTimes--,He.usedTimes===0&&I(C)),N.__cacheKey=re,N.__webglTexture=he[re].texture}return W}function ot(N,C,W){return Math.floor(Math.floor(N/W)/C)}function Tt(N,C,W,se){const re=N.updateRanges;if(re.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,C.width,C.height,W,se,C.data);else{re.sort((ye,we)=>ye.start-we.start);let He=0;for(let ye=1;ye0){V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const We=Mm(te.width,te.height,C.format,C.type);for(const st of C.layerUpdates){const Et=te.data.subarray(st*We/te.data.BYTES_PER_ELEMENT,(st+1)*We/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,st,te.width,te.height,1,we,Et)}C.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,te.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,te.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Se,0,0,0,te.width,te.height,ye.depth,we,Ye,te.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Se,k,te.width,te.height,ye.depth,0,we,Ye,te.data)}else{V&&ve&&t.texStorage2D(r.TEXTURE_2D,Be,k,Le[0].width,Le[0].height);for(let Se=0,oe=Le.length;Se0){const Se=Mm(ye.width,ye.height,C.format,C.type);for(const oe of C.layerUpdates){const We=ye.data.subarray(oe*Se/ye.data.BYTES_PER_ELEMENT,(oe+1)*Se/ye.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,oe,ye.width,ye.height,1,we,Ye,We)}C.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isData3DTexture)V?(ve&&t.texStorage3D(r.TEXTURE_3D,Be,k,ye.width,ye.height,ye.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ye.width,ye.height,ye.depth,we,Ye,ye.data)):t.texImage3D(r.TEXTURE_3D,0,k,ye.width,ye.height,ye.depth,0,we,Ye,ye.data);else if(C.isFramebufferTexture){if(ve)if(V)t.texStorage2D(r.TEXTURE_2D,Be,k,ye.width,ye.height);else{let Se=ye.width,oe=ye.height;for(let We=0;We>=1,oe>>=1}}else if(Le.length>0){if(V&&ve){const Se=Me(Le[0]);t.texStorage2D(r.TEXTURE_2D,Be,k,Se.width,Se.height)}for(let Se=0,oe=Le.length;Se0&&Be++;const oe=Me(we[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Le,oe.width,oe.height)}for(let oe=0;oe<6;oe++)if(ye){V?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,we[oe].width,we[oe].height,k,te,we[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,Le,we[oe].width,we[oe].height,0,k,te,we[oe].data);for(let We=0;We>re),Ye=Math.max(1,C.height>>re);he===r.TEXTURE_3D||he===r.TEXTURE_2D_ARRAY?t.texImage3D(he,re,Je,we,Ye,C.depth,0,He,Te,null):t.texImage2D(he,re,Je,we,Ye,0,He,Te,null)}t.bindFramebuffer(r.FRAMEBUFFER,N),Qe(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,se,he,ye.__webglTexture,0,B(C)):(he===r.TEXTURE_2D||he>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,se,he,ye.__webglTexture,re),t.bindFramebuffer(r.FRAMEBUFFER,null)}function $e(N,C,W){if(r.bindRenderbuffer(r.RENDERBUFFER,N),C.depthBuffer){const se=C.depthTexture,he=se&&se.isDepthTexture?se.type:null,re=w(C.stencilBuffer,he),He=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Qe(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(C),re,C.width,C.height):W?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(C),re,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,re,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,He,r.RENDERBUFFER,N)}else{const se=C.textures;for(let he=0;he{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,se.removeEventListener("dispose",he)};se.addEventListener("dispose",he),C.__depthDisposeCallback=he}C.__boundDepthTexture=se}if(N.depthTexture&&!C.__autoAllocateDepthBuffer)if(W)for(let se=0;se<6;se++)et(C.__webglFramebuffer[se],N,se);else{const se=N.texture.mipmaps;se&&se.length>0?et(C.__webglFramebuffer[0],N,0):et(C.__webglFramebuffer,N,0)}else if(W){C.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[se]),C.__webglDepthbuffer[se]===void 0)C.__webglDepthbuffer[se]=r.createRenderbuffer(),$e(C.__webglDepthbuffer[se],N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer[se];r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}else{const se=N.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),$e(C.__webglDepthbuffer,N,!1);else{const he=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,re=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,re),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,re)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function wt(N,C,W){const se=n.get(N);C!==void 0&&Ce(se.__webglFramebuffer,N,N.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&<(N)}function at(N){const C=N.texture,W=n.get(N),se=n.get(C);N.addEventListener("dispose",U);const he=N.textures,re=N.isWebGLCubeRenderTarget===!0,He=he.length>1;if(He||(se.__webglTexture===void 0&&(se.__webglTexture=r.createTexture()),se.__version=C.version,l.memory.textures++),re){W.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(C.mipmaps&&C.mipmaps.length>0){W.__webglFramebuffer[Te]=[];for(let Je=0;Je0){W.__webglFramebuffer=[];for(let Te=0;Te0&&Qe(N)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Te=0;Te0)for(let Je=0;Je0)for(let Je=0;Je0){if(Qe(N)===!1){const C=N.textures,W=N.width,se=N.height;let he=r.COLOR_BUFFER_BIT;const re=N.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,He=n.get(N),Te=C.length>1;if(Te)for(let rt=0;rt0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function Oe(N){const C=l.render.frame;p.get(N)!==C&&(p.set(N,C),N.update())}function nt(N,C){const W=N.colorSpace,se=N.format,he=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||W!==Er&&W!==Vs&&(Dt.getTransfer(W)===Wt?(se!==jn||he!==ti)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",W)),C}function Me(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(f.width=N.naturalWidth||N.width,f.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(f.width=N.displayWidth,f.height=N.displayHeight):(f.width=N.width,f.height=N.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=X,this.setTexture2D=q,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=pe,this.rebindTextures=wt,this.setupRenderTarget=at,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qb(r,e){function t(n,i=Vs){let o;const l=Dt.getTransfer(i);if(n===ti)return r.UNSIGNED_BYTE;if(n===hf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ff)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Gm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vm)return r.BYTE;if(n===Hm)return r.SHORT;if(n===No)return r.UNSIGNED_SHORT;if(n===uf)return r.INT;if(n===Oi)return r.UNSIGNED_INT;if(n===ii)return r.FLOAT;if(n===_s)return r.HALF_FLOAT;if(n===Xm)return r.ALPHA;if(n===qm)return r.RGB;if(n===jn)return r.RGBA;if(n===xs)return r.DEPTH_COMPONENT;if(n===yr)return r.DEPTH_STENCIL;if(n===df)return r.RED;if(n===dc)return r.RED_INTEGER;if(n===Ma)return r.RG;if(n===pf)return r.RG_INTEGER;if(n===mf)return r.RGBA_INTEGER;if(n===Vl||n===Hl||n===Gl||n===Wl)if(l===Wt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Vl)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Vl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Wl)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_h||n===xh||n===yh||n===bh)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===_h)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===xh)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===yh)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bh)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Sh||n===Mh||n===Eh||n===Th||n===wh||n===Ah||n===Ch)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Sh||n===Mh)return l===Wt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Eh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===Th)return o.COMPRESSED_R11_EAC;if(n===wh)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Ah)return o.COMPRESSED_RG11_EAC;if(n===Ch)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Rh||n===Ih||n===Ph||n===Lh||n===Dh||n===Nh||n===Uh||n===Fh||n===Oh||n===Bh||n===zh||n===kh||n===Vh||n===Hh)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Rh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ih)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ph)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Lh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Dh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Nh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Fh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Oh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Bh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===zh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===kh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hh)return l===Wt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Wh||n===Xh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Gh)return l===Wt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wh)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xh)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===qh||n===Yh||n===jh||n===Zh)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===qh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Yh)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zh)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Uo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rP=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,aP=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class oP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new ng(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bi({vertexShader:rP,fragmentShader:aP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bn(new Xo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lP extends ys{constructor(e,t){super();const n=this;let i=null,o=1,l=null,c="local-floor",h=1,f=null,p=null,g=null,m=null,v=null,_=null;const E=typeof XRWebGLBinding<"u",b=new oP,y={},M=t.getContextAttributes();let T=null,w=null;const P=[],R=[],U=new ue;let A=null;const I=new dn;I.viewport=new Zt;const z=new dn;z.viewport=new Zt;const O=[I,z],X=new Nb;let G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=P[le];return Ae===void 0&&(Ae=new ah,P[le]=Ae),Ae.getHandSpace()};function q(le){const Ae=R.indexOf(le.inputSource);if(Ae===-1)return;const Ce=P[Ae];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,f||l),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",J);for(let le=0;le=0&&(R[$e]=null,P[$e].disconnect(Ce))}for(let Ae=0;Ae=R.length){R.push(Ce),$e=lt;break}else if(R[lt]===null){R[lt]=Ce,$e=lt;break}if($e===-1)break}const et=P[$e];et&&et.connect(Ce)}}const pe=new F,ce=new F;function Ee(le,Ae,Ce){pe.setFromMatrixPosition(Ae.matrixWorld),ce.setFromMatrixPosition(Ce.matrixWorld);const $e=pe.distanceTo(ce),et=Ae.projectionMatrix.elements,lt=Ce.projectionMatrix.elements,wt=et[14]/(et[10]-1),at=et[14]/(et[10]+1),de=(et[9]+1)/et[5],xe=(et[9]-1)/et[5],fe=(et[8]-1)/et[0],Pe=(lt[8]+1)/lt[0],B=wt*fe,Qe=wt*Pe,Oe=$e/(-fe+Pe),nt=Oe*-fe;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(nt),le.translateZ(Oe),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),et[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const Me=wt+Oe,N=at+Oe,C=B-nt,W=Qe+($e-nt),se=de*at/N*Me,he=xe*at/N*Me;le.projectionMatrix.makePerspective(C,W,se,he,Me,N),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function me(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Ce=le.far;b.texture!==null&&(b.depthNear>0&&(Ae=b.depthNear),b.depthFar>0&&(Ce=b.depthFar)),X.near=z.near=I.near=Ae,X.far=z.far=I.far=Ce,(G!==X.near||j!==X.far)&&(i.updateRenderState({depthNear:X.near,depthFar:X.far}),G=X.near,j=X.far),X.layers.mask=le.layers.mask|6,I.layers.mask=X.layers.mask&-5,z.layers.mask=X.layers.mask&-3;const $e=le.parent,et=X.cameras;me(X,$e);for(let lt=0;lt0&&(b.alphaTest.value=y.alphaTest);const M=e.get(y),T=M.envMap,w=M.envMapRotation;T&&(b.envMap.value=T,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),b.envMapRotation.value.setFromMatrix4(cP.makeRotationFromEuler(ca)),b.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function c(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function h(b,y,M,T){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*M,b.scale.value=T*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function f(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,M){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===si&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function E(b,y){const M=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function hP(r,e,t,n){let i={},o={},l=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function h(M,T){const w=T.program;n.uniformBlockBinding(M,w)}function f(M,T){let w=i[M.id];w===void 0&&(_(M),w=p(M),i[M.id]=w,M.addEventListener("dispose",b));const P=T.program;n.updateUBOMapping(M,P);const R=e.render.frame;o[M.id]!==R&&(m(M),o[M.id]=R)}function p(M){const T=g();M.__bindingPointIndex=T;const w=r.createBuffer(),P=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,P,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,T,w),w}function g(){for(let M=0;M0&&(w+=P-R),M.__size=w,M.__cache={},this}function E(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",M),T}function b(M){const T=M.target;T.removeEventListener("dispose",b);const w=l.indexOf(T.__bindingPointIndex);l.splice(w,1),r.deleteBuffer(i[T.id]),delete i[T.id],delete o[T.id]}function y(){for(const M in i)r.deleteBuffer(i[M]);l=[],i={},o={}}return{bind:h,update:f,dispose:y}}const fP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let fs=null;function dP(){return fs===null&&(fs=new is(fP,16,16,Ma,_s),fs.name="DFG_LUT",fs.minFilter=Qt,fs.magFilter=Qt,fs.wrapS=pi,fs.wrapT=pi,fs.generateMipmaps=!1,fs.needsUpdate=!0),fs}class Yb{constructor(e={}){const{canvas:t=Oy(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:m=!1,outputBufferType:v=ti}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const E=v,b=new Set([mf,pf,dc]),y=new Set([ti,Oi,No,Uo,hf,ff]),M=new Uint32Array(4),T=new Int32Array(4);let w=null,P=null;const R=[],U=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Yn;let O=0,X=0,G=null,j=-1,q=null;const $=new Zt,J=new Zt;let pe=null;const ce=new Xe(0);let Ee=0,me=t.width,_e=t.height,qe=1,ot=null,Tt=null;const le=new Zt(0,0,me,_e),Ae=new Zt(0,0,me,_e);let Ce=!1;const $e=new Wo;let et=!1,lt=!1;const wt=new mt,at=new F,de=new Zt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Pe(){return G===null?qe:1}let B=n;function Qe(D,Y){return t.getContext(D,Y)}try{const D={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${of}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",st,!1),t.addEventListener("webglcontextcreationerror",Et,!1),B===null){const Y="webgl2";if(B=Qe(Y,D),B===null)throw Qe(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw it("WebGLRenderer: "+D.message),D}let Oe,nt,Me,N,C,W,se,he,re,He,Te,Je,rt,ye,we,Ye,k,te,Le,V,ve,be,Be;function Se(){Oe=new mI(B),Oe.init(),ve=new qb(B,Oe),nt=new oI(B,Oe,e,ve),Me=new iP(B,Oe),nt.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),N=new _I(B),C=new G3,W=new sP(B,Oe,Me,C,nt,ve,N),se=new pI(I),he=new MA(B),be=new rI(B,he),re=new gI(B,he,N,be),He=new yI(B,re,he,be,N),te=new xI(B,nt,W),we=new lI(C),Te=new H3(I,se,Oe,nt,be,we),Je=new uP(I,C),rt=new X3,ye=new J3(Oe),k=new sI(I,se,Me,He,_,h),Ye=new nP(I,He,nt),Be=new hP(B,N,nt,Me),Le=new aI(B,Oe,N),V=new vI(B,Oe,N),N.programs=Te.programs,I.capabilities=nt,I.extensions=Oe,I.properties=C,I.renderLists=rt,I.shadowMap=Ye,I.state=Me,I.info=N}Se(),E!==ti&&(A=new SI(E,t.width,t.height,i,o));const oe=new lP(I,B);this.xr=oe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const D=Oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=Oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return qe},this.setPixelRatio=function(D){D!==void 0&&(qe=D,this.setSize(me,_e,!1))},this.getSize=function(D){return D.set(me,_e)},this.setSize=function(D,Y,ne=!0){if(oe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}me=D,_e=Y,t.width=Math.floor(D*qe),t.height=Math.floor(Y*qe),ne===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(me*qe,_e*qe).floor()},this.setDrawingBufferSize=function(D,Y,ne){me=D,_e=Y,qe=ne,t.width=Math.floor(D*ne),t.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.setEffects=function(D){if(E===ti){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(D){for(let Y=0;Y{function Ne(){if(Q.forEach(function(Fe){C.get(Fe).currentProgram.isReady()&&Q.delete(Fe)}),Q.size===0){K(D);return}setTimeout(Ne,10)}Oe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let js=null;function bc(D){js&&js(D)}function Pr(){ki.stop()}function Lr(){ki.start()}const ki=new Vb;ki.setAnimationLoop(bc),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(D){js=D,oe.setAnimationLoop(D),D===null?ki.stop():ki.start()},oe.addEventListener("sessionstart",Pr),oe.addEventListener("sessionend",Lr),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ne=oe.enabled===!0&&oe.isPresenting===!0,Q=A!==null&&(G===null||ne)&&A.begin(I,G);if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(Y),Y=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(I,D,Y,G),P=ye.get(D,U.length),P.init(Y),U.push(P),wt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),$e.setFromProjectionMatrix(wt,Ai,Y.reversedDepth),lt=this.localClippingEnabled,et=we.init(this.clippingPlanes,lt),w=rt.get(D,R.length),w.init(),R.push(w),oe.enabled===!0&&oe.isPresenting===!0){const Fe=I.xr.getDepthSensingMesh();Fe!==null&&Vi(Fe,Y,-1/0,I.sortObjects)}Vi(D,Y,0,I.sortObjects),w.finish(),I.sortObjects===!0&&w.sort(ot,Tt),fe=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,fe&&k.addToRenderList(w,D),this.info.render.frame++,et===!0&&we.beginShadows();const K=P.state.shadowsArray;if(Ye.render(K,D,Y),et===!0&&we.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&A.hasRenderPass())===!1){const Fe=w.opaque,Ve=w.transmissive;if(P.setupLights(),Y.isArrayCamera){const De=Y.cameras;if(Ve.length>0)for(let Ke=0,gt=De.length;Ke0&&Dr(Fe,Ve,D,Y),fe&&k.render(D),Zo(w,D,Y)}G!==null&&X===0&&(W.updateMultisampleRenderTarget(G),W.updateRenderTargetMipmap(G)),Q&&A.end(I),D.isScene===!0&&D.onAfterRender(I,D,Y),be.resetDefaultState(),j=-1,q=null,U.pop(),U.length>0?(P=U[U.length-1],et===!0&&we.setGlobalState(I.clippingPlanes,P.state.camera)):P=null,R.pop(),R.length>0?w=R[R.length-1]:w=null};function Vi(D,Y,ne,Q){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)P.pushLight(D),D.castShadow&&P.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||$e.intersectsSprite(D)){Q&&de.setFromMatrixPosition(D.matrixWorld).applyMatrix4(wt);const Fe=He.update(D),Ve=D.material;Ve.visible&&w.push(D,Fe,Ve,ne,de.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||$e.intersectsObject(D))){const Fe=He.update(D),Ve=D.material;if(Q&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),de.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),de.copy(Fe.boundingSphere.center)),de.applyMatrix4(D.matrixWorld).applyMatrix4(wt)),Array.isArray(Ve)){const De=Fe.groups;for(let Ke=0,gt=De.length;Ke0&&Zs(K,Y,ne),Ne.length>0&&Zs(Ne,Y,ne),Fe.length>0&&Zs(Fe,Y,ne),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Dr(D,Y,ne,Q){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[Q.id]===void 0){const tt=Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[Q.id]=new Ri(1,1,{generateMipmaps:!0,type:tt?_s:ti,minFilter:ps,samples:Math.max(4,nt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const Ne=P.state.transmissionRenderTarget[Q.id],Fe=Q.viewport||$;Ne.setSize(Fe.z*I.transmissionResolutionScale,Fe.w*I.transmissionResolutionScale);const Ve=I.getRenderTarget(),De=I.getActiveCubeFace(),Ke=I.getActiveMipmapLevel();I.setRenderTarget(Ne),I.getClearColor(ce),Ee=I.getClearAlpha(),Ee<1&&I.setClearColor(16777215,.5),I.clear(),fe&&k.render(ne);const gt=I.toneMapping;I.toneMapping=Fi;const yt=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),P.setupLightsView(Q),et===!0&&we.setGlobalState(I.clippingPlanes,Q),Zs(D,ne,Q),W.updateMultisampleRenderTarget(Ne),W.updateRenderTargetMipmap(Ne),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let Gt=0,Jt=Y.length;Gt0),tt=!!ne.morphAttributes.position,Gt=!!ne.morphAttributes.normal,Jt=!!ne.morphAttributes.color;let $t=Fi;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&($t=I.toneMapping);const Ot=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Bt=Ot!==void 0?Ot.length:0,Ue=C.get(Q),Cn=P.state.lights;if(et===!0&&(lt===!0||D!==q)){const un=D===q&&Q.id===j;we.setState(Q,D,un)}let Ct=!1;Q.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Cn.state.version||Ue.outputColorSpace!==Ve||K.isBatchedMesh&&Ue.batching===!1||!K.isBatchedMesh&&Ue.batching===!0||K.isBatchedMesh&&Ue.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Ue.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Ue.instancing===!1||!K.isInstancedMesh&&Ue.instancing===!0||K.isSkinnedMesh&&Ue.skinning===!1||!K.isSkinnedMesh&&Ue.skinning===!0||K.isInstancedMesh&&Ue.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Ue.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Ue.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Ue.instancingMorph===!1&&K.morphTexture!==null||Ue.envMap!==Ke||Q.fog===!0&&Ue.fog!==Ne||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==we.numPlanes||Ue.numIntersection!==we.numIntersection)||Ue.vertexAlphas!==gt||Ue.vertexTangents!==yt||Ue.morphTargets!==tt||Ue.morphNormals!==Gt||Ue.morphColors!==Jt||Ue.toneMapping!==$t||Ue.morphTargetsCount!==Bt)&&(Ct=!0):(Ct=!0,Ue.__version=Q.version);let kn=Ue.currentProgram;Ct===!0&&(kn=gi(Q,Y,K));let ai=!1,Dn=!1,Gi=!1;const Ht=kn.getUniforms(),cn=Ue.uniforms;if(Me.useProgram(kn.program)&&(ai=!0,Dn=!0,Gi=!0),Q.id!==j&&(j=Q.id,Dn=!0),ai||q!==D){Me.buffers.depth.getReversed()&&D.reversedDepth!==!0&&(D._reversedDepth=!0,D.updateProjectionMatrix()),Ht.setValue(B,"projectionMatrix",D.projectionMatrix),Ht.setValue(B,"viewMatrix",D.matrixWorldInverse);const Xi=Ht.map.cameraPosition;Xi!==void 0&&Xi.setValue(B,at.setFromMatrixPosition(D.matrixWorld)),nt.logarithmicDepthBuffer&&Ht.setValue(B,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ht.setValue(B,"isOrthographic",D.isOrthographicCamera===!0),q!==D&&(q=D,Dn=!0,Gi=!0)}if(Ue.needsLights&&(Cn.state.directionalShadowMap.length>0&&Ht.setValue(B,"directionalShadowMap",Cn.state.directionalShadowMap,W),Cn.state.spotShadowMap.length>0&&Ht.setValue(B,"spotShadowMap",Cn.state.spotShadowMap,W),Cn.state.pointShadowMap.length>0&&Ht.setValue(B,"pointShadowMap",Cn.state.pointShadowMap,W)),K.isSkinnedMesh){Ht.setOptional(B,K,"bindMatrix"),Ht.setOptional(B,K,"bindMatrixInverse");const un=K.skeleton;un&&(un.boneTexture===null&&un.computeBoneTexture(),Ht.setValue(B,"boneTexture",un.boneTexture,W))}K.isBatchedMesh&&(Ht.setOptional(B,K,"batchingTexture"),Ht.setValue(B,"batchingTexture",K._matricesTexture,W),Ht.setOptional(B,K,"batchingIdTexture"),Ht.setValue(B,"batchingIdTexture",K._indirectTexture,W),Ht.setOptional(B,K,"batchingColorTexture"),K._colorsTexture!==null&&Ht.setValue(B,"batchingColorTexture",K._colorsTexture,W));const Wi=ne.morphAttributes;if((Wi.position!==void 0||Wi.normal!==void 0||Wi.color!==void 0)&&te.update(K,ne,kn),(Dn||Ue.receiveShadow!==K.receiveShadow)&&(Ue.receiveShadow=K.receiveShadow,Ht.setValue(B,"receiveShadow",K.receiveShadow)),(Q.isMeshStandardMaterial||Q.isMeshLambertMaterial||Q.isMeshPhongMaterial)&&Q.envMap===null&&Y.environment!==null&&(cn.envMapIntensity.value=Y.environmentIntensity),cn.dfgLUT!==void 0&&(cn.dfgLUT.value=dP()),Dn&&(Ht.setValue(B,"toneMappingExposure",I.toneMappingExposure),Ue.needsLights&&Nr(cn,Gi),Ne&&Q.fog===!0&&Je.refreshFogUniforms(cn,Ne),Je.refreshMaterialUniforms(cn,Q,qe,_e,P.state.transmissionRenderTarget[D.id]),oh.upload(B,Hi(Ue),cn,W)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(oh.upload(B,Hi(Ue),cn,W),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ht.setValue(B,"center",K.center),Ht.setValue(B,"modelViewMatrix",K.modelViewMatrix),Ht.setValue(B,"normalMatrix",K.normalMatrix),Ht.setValue(B,"modelMatrix",K.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){const un=Q.uniformsGroups;for(let Xi=0,Ss=un.length;Xi0&&W.useMultisampledRTT(D)===!1?Q=C.get(D).__webglMultisampledFramebuffer:Array.isArray(Ke)?Q=Ke[ne]:Q=Ke,$.copy(D.viewport),J.copy(D.scissor),pe=D.scissorTest}else $.copy(le).multiplyScalar(qe).floor(),J.copy(Ae).multiplyScalar(qe).floor(),pe=Ce;if(ne!==0&&(Q=Sc),Me.bindFramebuffer(B.FRAMEBUFFER,Q)&&Me.drawBuffers(D,Q),Me.viewport($),Me.scissor(J),Me.setScissorTest(pe),K){const Ve=C.get(D.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ve.__webglTexture,ne)}else if(Ne){const Ve=Y;for(let De=0;De1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!nt.textureTypeReadable(yt)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K&&B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),Ne)}finally{const Ke=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(D,Y,ne,Q,K,Ne,Fe,Ve=0){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let De=C.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(De=De[Fe]),De)if(Y>=0&&Y<=D.width-Q&&ne>=0&&ne<=D.height-K){Me.bindFramebuffer(B.FRAMEBUFFER,De);const Ke=D.textures[Ve],gt=Ke.format,yt=Ke.type;if(D.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Ve),!nt.textureFormatReadable(gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!nt.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.bufferData(B.PIXEL_PACK_BUFFER,Ne.byteLength,B.STREAM_READ),B.readPixels(Y,ne,Q,K,ve.convert(gt),ve.convert(yt),0);const Gt=G!==null?C.get(G).__webglFramebuffer:null;Me.bindFramebuffer(B.FRAMEBUFFER,Gt);const Jt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await EE(B,Jt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,tt),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Ne),B.deleteBuffer(tt),B.deleteSync(Jt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,Y=null,ne=0){const Q=Math.pow(2,-ne),K=Math.floor(D.image.width*Q),Ne=Math.floor(D.image.height*Q),Fe=Y!==null?Y.x:0,Ve=Y!==null?Y.y:0;W.setTexture2D(D,0),B.copyTexSubImage2D(B.TEXTURE_2D,ne,0,0,Fe,Ve,K,Ne),Me.unbindTexture()};const Mc=B.createFramebuffer(),Ec=B.createFramebuffer();this.copyTextureToTexture=function(D,Y,ne=null,Q=null,K=0,Ne=0){let Fe,Ve,De,Ke,gt,yt,tt,Gt,Jt;const $t=D.isCompressedTexture?D.mipmaps[Ne]:D.image;if(ne!==null)Fe=ne.max.x-ne.min.x,Ve=ne.max.y-ne.min.y,De=ne.isBox3?ne.max.z-ne.min.z:1,Ke=ne.min.x,gt=ne.min.y,yt=ne.isBox3?ne.min.z:0;else{const cn=Math.pow(2,-K);Fe=Math.floor($t.width*cn),Ve=Math.floor($t.height*cn),D.isDataArrayTexture?De=$t.depth:D.isData3DTexture?De=Math.floor($t.depth*cn):De=1,Ke=0,gt=0,yt=0}Q!==null?(tt=Q.x,Gt=Q.y,Jt=Q.z):(tt=0,Gt=0,Jt=0);const Ot=ve.convert(Y.format),Bt=ve.convert(Y.type);let Ue;Y.isData3DTexture?(W.setTexture3D(Y,0),Ue=B.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(W.setTexture2DArray(Y,0),Ue=B.TEXTURE_2D_ARRAY):(W.setTexture2D(Y,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Y.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Y.unpackAlignment);const Cn=B.getParameter(B.UNPACK_ROW_LENGTH),Ct=B.getParameter(B.UNPACK_IMAGE_HEIGHT),kn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),Dn=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$t.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$t.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ke),B.pixelStorei(B.UNPACK_SKIP_ROWS,gt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,yt);const Gi=D.isDataArrayTexture||D.isData3DTexture,Ht=Y.isDataArrayTexture||Y.isData3DTexture;if(D.isDepthTexture){const cn=C.get(D),Wi=C.get(Y),un=C.get(cn.__renderTarget),Xi=C.get(Wi.__renderTarget);Me.bindFramebuffer(B.READ_FRAMEBUFFER,un.__webglFramebuffer),Me.bindFramebuffer(B.DRAW_FRAMEBUFFER,Xi.__webglFramebuffer);for(let Ss=0;Ss"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return em.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,em}var Lx;function gP(){return Lx||(Lx=1,Qp.exports=mP()),Qp.exports}var Dx;function vP(){if(Dx)return Kp;Dx=1;var r=Kx(),e=gP();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=r.useRef,l=r.useEffect,c=r.useMemo,h=r.useDebugValue;return Kp.useSyncExternalStoreWithSelector=function(f,p,g,m,v){var _=o(null);if(_.current===null){var E={hasValue:!1,value:null};_.current=E}else E=_.current;_=c(function(){function y(R){if(!M){if(M=!0,T=R,R=m(R),v!==void 0&&E.hasValue){var U=E.value;if(v(U,R))return w=U}return w=R}if(U=w,n(T,R))return U;var A=m(R);return v!==void 0&&v(U,A)?(T=R,U):(T=R,w=A)}var M=!1,T,w,P=g===void 0?null:g;return[function(){return y(p())},P===null?void 0:function(){return y(P())}]},[p,g,m,v]);var b=i(f,_[0],_[1]);return l(function(){E.hasValue=!0,E.value=b},[b]),h(b),b},Kp}var Nx;function _P(){return Nx||(Nx=1,Jp.exports=vP()),Jp.exports}var xP=_P();const yP=Qx(xP),Ux=r=>{let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(n,i,c);return c},bP=(r=>r?Ux(r):Ux),{useSyncExternalStoreWithSelector:SP}=yP,MP=r=>r;function EP(r,e=MP,t){const n=SP(r.subscribe,r.getState,r.getInitialState,e,t);return ey.useDebugValue(n),n}const Fx=(r,e)=>{const t=bP(r),n=(i,o=e)=>EP(t,i,o);return Object.assign(n,t),n},jb=((r,e)=>r?Fx(r,e):Fx),TP=r=>typeof r=="object"&&typeof r.then=="function",_a=[];function Zb(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.remove,n.lifespan)),o.response;if(!t)throw o.promise}const i={keys:e,equal:n.equal,remove:()=>{const o=_a.indexOf(i);o!==-1&&_a.splice(o,1)},promise:(TP(r)?r:r(...e)).then(o=>{i.response=o,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(o=>i.error=o)};if(_a.push(i),!t)throw i.promise}const wP=(r,e,t)=>$b(r,e,!1,t),AP=(r,e,t)=>{$b(r,e,!0,t)},CP=r=>{if(r===void 0||r.length===0)_a.splice(0,_a.length);else{const e=_a.find(t=>Zb(r,t.keys,t.equal));e&&e.remove()}};var Am=I1();const RP=Qx(Am);function wg(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const i=wg(n,e,t);if(i)return i;n=e?null:n.sibling}}function Jb(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const Ag=Jb(ft.createContext(null));class Kb extends ft.Component{render(){return ft.createElement(Ag.Provider,{value:this._reactInternals},this.props.children)}}function Qb(){const r=ft.useContext(Ag);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=ft.useId();return ft.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=wg(t,!1,i=>{let o=i.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[r,e])}const IP=Symbol.for("react.context"),PP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===IP;function LP(){const r=Qb(),[e]=ft.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;PP(n)&&n!==Ag&&!e.has(n)&&e.set(n,ft.use(Jb(n))),t=t.return}return e}function DP(){const r=LP();return ft.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>ft.createElement(e,null,ft.createElement(t.Provider,{...n,value:r.get(t)})),e=>ft.createElement(Kb,{...e})),[r])}function eS(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const tS=r=>r&&r.isOrthographicCamera,NP=r=>r&&r.hasOwnProperty("current"),UP=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),yc=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ft.useLayoutEffect:ft.useEffect;function Cg(r){const e=ft.useRef(r);return yc(()=>{e.current=r},[r]),e}function FP(){const r=Qb(),e=DP();return ft.useMemo(()=>({children:t})=>{const i=!!wg(r,!0,o=>o.type===ft.StrictMode)?ft.StrictMode:ft.Fragment;return On.jsx(i,{children:On.jsx(e,{children:t})})},[r,e])}function OP({set:r}){return yc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const BP=(r=>(r=class extends ft.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function nS(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function wo(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const en={obj:r=>r===Object(r)&&!en.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(en.str(r)||en.num(r)||en.boo(r))return r===e;const o=en.obj(r);if(o&&n==="reference")return r===e;const l=en.arr(r);if(l&&t==="reference")return r===e;if((l||o)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!en.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(en.und(c)){if(l&&r.length===0&&e.length===0||o&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function zP(r){const e={nodes:{},materials:{},meshes:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function kP(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const iS=["children","key","ref"];function VP(r){const e={};for(const t in r)iS.includes(t)||(e[t]=r[t]);return e}function tf(r,e,t,n){const i=r;let o=i?.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:VP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=o)),o}function hc(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(i)).join("-");return{root:t,key:o,target:void 0}}return{root:r,key:e,target:void 0}}e=i,r=t,t=t[e]}return{root:r,key:e,target:t}}const Ox=/-\d+$/;function nf(r,e){if(en.str(e.props.attach)){if(Ox.test(e.props.attach)){const i=e.props.attach.replace(Ox,""),{root:o,key:l}=hc(r.object,i);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=hc(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else en.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function sf(r,e){if(en.str(e.props.attach)){const{root:t,key:n}=hc(r.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const Cm=[...iS,"args","dispose","attach","object","onUpdate","dispose"],Bx=new Map;function HP(r){let e=Bx.get(r.constructor);try{e||(e=new r.constructor,Bx.set(r.constructor,e))}catch{}return e}function GP(r,e){const t={};for(const n in e)if(!Cm.includes(n)&&!en.equ(e[n],r.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in r.props){if(Cm.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:o}=hc(r.object,n);if(i.constructor&&i.constructor.length===0){const l=HP(i);en.und(l)||(t[o]=l[o])}else t[o]=0}return t}const WP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xr(r,e){var t;const n=r.__r3f,i=n&&eS(n).getState(),o=n?.eventCount;for(const c in e){let h=e[c];if(Cm.includes(c))continue;if(n&&XP.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:g}=hc(r,c);if(g===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof Oo&&h instanceof Oo)g.mask=h.mask;else if(g instanceof Xe&&UP(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else{var l;f[p]=h,i&&!i.linear&&WP.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===jn&&f[p].type===ti&&(f[p].colorSpace=Yn)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=i.internal.interaction.indexOf(c);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&i.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&jo(n),r}function jo(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function sS(r,e){r.manual||(tS(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ei=r=>r?.isObject3D;function nh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function rS(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function qP(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{rS(t.capturedMap,e,n,i)})}function YP(r){function e(h){const{internal:f}=r.getState(),p=h.offsetX-f.initialClick[0],g=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=f.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,f){const p=r.getState(),g=new Set,m=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let y=0;y{const T=wo(y.object),w=wo(M.object);return!T||!w?y.distance-M.distance:w.events.priority-T.events.priority||y.distance-M.distance}).filter(y=>{const M=nh(y);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(E=p.events.filter(E,p));for(const y of E){let M=y.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let y of p.internal.capturedMap.get(h.pointerId).values())g.has(nh(y.intersection))||m.push(y.intersection);return m}function i(h,f,p,g){if(h.length){const m={stopped:!1};for(const v of h){let _=wo(v.object);if(_||v.object.traverseAncestors(E=>{const b=wo(E);if(b)return _=b,!1}),_){const{raycaster:E,pointer:b,camera:y,internal:M}=_,T=new F(b.x,b.y,0).unproject(y),w=I=>{var z,O;return(z=(O=M.capturedMap.get(I))==null?void 0:O.has(v.eventObject))!=null?z:!1},P=I=>{const z={intersection:v,target:f.target};M.capturedMap.has(I)?M.capturedMap.get(I).set(v.eventObject,z):M.capturedMap.set(I,new Map([[v.eventObject,z]])),f.target.setPointerCapture(I)},R=I=>{const z=M.capturedMap.get(I);z&&rS(M.capturedMap,v.eventObject,z,I)};let U={};for(let I in f){let z=f[I];typeof z!="function"&&(U[I]=z)}let A={...v,...U,pointer:b,intersections:h,stopped:m.stopped,delta:p,unprojectedPoint:T,ray:E.ray,camera:y,stopPropagation(){const I="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!I||I.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===v.eventObject))){const z=h.slice(0,h.indexOf(v));o([...z,v])}},target:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},currentTarget:{hasPointerCapture:w,setPointerCapture:P,releasePointerCapture:R},nativeEvent:f};if(g(A),m.stopped===!0)break}}}return h}function o(h){const{internal:f}=r.getState();for(const p of f.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(f.hovered.delete(nh(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(h,f){for(let p=0;po([]);case"onLostPointerCapture":return f=>{const{internal:p}=r.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:m}=r.getState();m.lastEvent.current=p;const v=h==="onPointerMove",_=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,v?t:void 0),y=_?e(p):0;h==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(T=>T.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&o(b);function M(T){const w=T.eventObject,P=w.__r3f;if(!(P!=null&&P.eventCount))return;const R=P.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const U=nh(T),A=m.hovered.get(U);A?A.stopped&&T.stopPropagation():(m.hovered.set(U,T),R.onPointerOver==null||R.onPointerOver(T),R.onPointerEnter==null||R.onPointerEnter(T))}R.onPointerMove==null||R.onPointerMove(T)}else{const U=R[h];U?(!_||m.initialHits.includes(w))&&(l(p,m.interaction.filter(A=>!m.initialHits.includes(A))),U(T)):_&&m.initialHits.includes(w)&&l(p,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(b,p,y,M)}}return{handlePointer:c}}const zx=r=>!!(r!=null&&r.render),Rg=ft.createContext(null),jP=(r,e)=>{const t=jb((c,h)=>{const f=new F,p=new F,g=new F;function m(y=h().camera,M=p,T=h().size){const{width:w,height:P,top:R,left:U}=T,A=w/P;M.isVector3?g.copy(M):g.set(...M);const I=y.getWorldPosition(f).distanceTo(g);if(tS(y))return{width:w/y.zoom,height:P/y.zoom,top:R,left:U,factor:1,distance:I,aspect:A};{const z=y.fov*Math.PI/180,O=2*Math.tan(z/2)*I,X=O*(w/P);return{width:X,height:O,top:R,left:U,factor:w/X,distance:I,aspect:A}}}let v;const _=y=>c(M=>({performance:{...M.performance,current:y}})),E=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>r(h(),y),advance:(y,M)=>e(y,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zb,pointer:E,mouse:E,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=h();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(h().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>c(M=>({...M,events:{...M.events,...y}})),setSize:(y,M,T=0,w=0)=>{const P=h().camera,R={width:y,height:M,top:T,left:w};c(U=>({size:R,viewport:{...U.viewport,...m(P,p,R)}}))},setDpr:y=>c(M=>{const T=nS(y);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(y="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,y!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ft.createRef(),active:!1,frames:0,priority:0,subscribe:(y,M,T)=>{const w=h().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:y,priority:M,store:T}),w.subscribers=w.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=h().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(M>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:f,gl:p,set:g}=t.getState();if(h.width!==i.width||h.height!==i.height||f.dpr!==o){i=h,o=f.dpr,sS(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,m)}c!==l&&(l=c,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};function Ig(){const r=ft.useContext(Rg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function vr(r=t=>t,e){return Ig()(r,e)}function ZP(r,e=0){const t=Ig(),n=t.getState().internal.subscribe,i=Cg(r);return yc(()=>n(i,e,t),[e,n,t]),null}const kx=new WeakMap,$P=r=>{var e;return typeof r=="function"&&(r==null||(e=r.prototype)==null?void 0:e.constructor)===r};function aS(r,e){return function(t,...n){let i;return $P(t)?(i=kx.get(t),i||(i=new t,kx.set(t,i))):i=t,r&&r(i),Promise.all(n.map(o=>new Promise((l,c)=>i.load(o,h=>{ei(h?.scene)&&Object.assign(h,zP(h.scene)),l(h)},e,h=>c(new Error(`Could not load ${o}: ${h?.message}`))))))}}function oS(r,e,t,n){const i=Array.isArray(e)?e:[e],o=wP(aS(t,n),[r,...i],{equal:en.equ});return Array.isArray(e)?o:o[0]}oS.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AP(aS(t),[r,...n])};oS.clear=function(r,e){const t=Array.isArray(e)?e:[e];return CP([r,...t])};const JP=1,KP=8,QP=32,eL=2;var tL={version:"9.5.0"};function nL(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vx={exports:{}},Hx={exports:{}},Gx;function iL(){return Gx||(Gx=1,(function(r){r.exports=function(e){function t(s,a,u,d){return new US(s,a,u,d)}function n(){}function i(s){var a="https://react.dev/errors/"+s;if(1Va||(s.current=zd[Va],zd[Va]=null,Va--)}function _(s,a){Va++,zd[Va]=s.current,s.current=a}function E(s){return s>>>=0,s===0?32:31-(p1(s)/m1|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function y(s,a,u){var d=s.pendingLanes;if(d===0)return 0;var x=0,S=s.suspendedLanes,L=s.pingedLanes;s=s.warmLanes;var H=d&134217727;return H!==0?(d=H&~S,d!==0?x=b(d):(L&=H,L!==0?x=b(L):u||(u=H&~s,u!==0&&(x=b(u))))):(H=d&~S,H!==0?x=b(H):L!==0?x=b(L):u||(u=d&~s,u!==0&&(x=b(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function T(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function w(){var s=Xc;return Xc<<=1,(Xc&62914560)===0&&(Xc=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function R(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U(s,a,u,d,x,S){var L=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var H=s.entanglements,ae=s.expirationTimes,ge=s.hiddenUpdates;for(u=L&~u;0)":-1x||ae[d]!==ge[x]){var ze=` +`+ae[d].replace(" at new "," at ");return s.displayName&&ze.includes("")&&(ze=ze.replace("",s.displayName)),ze}while(1<=d&&0<=x);break}}}finally{Gd=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?q(u):""}function J(s,a){switch(s.tag){case 26:case 27:case 5:return q(s.type);case 16:return q("Lazy");case 13:return s.child!==a&&a!==null?q("Suspense Fallback"):q("Suspense");case 19:return q("SuspenseList");case 0:case 15:return $(s.type,!1);case 11:return $(s.type.render,!1);case 1:return $(s.type,!0);case 31:return q("Activity");default:return""}}function pe(s){try{var a="",u=null;do a+=J(s,u),u=s,s=s.return;while(s);return a}catch(d){return` +Error generating stack: `+d.message+` +`+d.stack}}function ce(s,a){if(typeof s=="object"&&s!==null){var u=jv.get(s);return u!==void 0?u:(a={value:s,source:a,stack:pe(a)},jv.set(s,a),a)}return{value:s,source:a,stack:pe(a)}}function Ee(s,a){Ga[Wa++]=ul,Ga[Wa++]=Yc,Yc=s,ul=a}function me(s,a,u){Pi[Li++]=os,Pi[Li++]=ls,Pi[Li++]=tr,tr=s;var d=os;s=ls;var x=32-xi(d)-1;d&=~(1<>=L,x-=L,os=1<<32-xi(a)+x|u<kt?(Pn=pt,pt=null):Pn=pt.sibling;var Vt=je(ee,pt,ie[kt],Ie);if(Vt===null){pt===null&&(pt=Pn);break}s&&pt&&Vt.alternate===null&&a(ee,pt),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt,pt=Pn}if(kt===ie.length)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;ktkt?(Pn=pt,pt=null):Pn=pt.sibling;var cr=je(ee,pt,Vt.value,Ie);if(cr===null){pt===null&&(pt=Pn);break}s&&pt&&cr.alternate===null&&a(ee,pt),Z=S(cr,Z,kt),sn===null?ht=cr:sn.sibling=cr,sn=cr,pt=Pn}if(Vt.done)return u(ee,pt),Nt&&Ee(ee,kt),ht;if(pt===null){for(;!Vt.done;kt++,Vt=ie.next())Vt=Re(ee,Vt.value,Ie),Vt!==null&&(Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return Nt&&Ee(ee,kt),ht}for(pt=d(pt);!Vt.done;kt++,Vt=ie.next())Vt=_t(pt,ee,kt,Vt.value,Ie),Vt!==null&&(s&&Vt.alternate!==null&&pt.delete(Vt.key===null?kt:Vt.key),Z=S(Vt,Z,kt),sn===null?ht=Vt:sn.sibling=Vt,sn=Vt);return s&&pt.forEach(function(R1){return a(ee,R1)}),Nt&&Ee(ee,kt),ht}function Zr(ee,Z,ie,Ie){if(typeof ie=="object"&&ie!==null&&ie.type===Ba&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case kc:e:{for(var ht=ie.key;Z!==null;){if(Z.key===ht){if(ht=ie.type,ht===Ba){if(Z.tag===7){u(ee,Z.sibling),Ie=x(Z,ie.props.children),Ie.return=ee,ee=Ie;break e}}else if(Z.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===er&&Et(ht)===Z.type){u(ee,Z.sibling),Ie=x(Z,ie.props),Ys(Ie,ie),Ie.return=ee,ee=Ie;break e}u(ee,Z);break}else a(ee,Z);Z=Z.sibling}ie.type===Ba?(Ie=zr(ie.props.children,ee.mode,Ie,ie.key),Ie.return=ee,ee=Ie):(Ie=zc(ie.type,ie.key,ie.props,null,ee.mode,Ie),Ys(Ie,ie),Ie.return=ee,ee=Ie)}return L(ee);case Oa:e:{for(ht=ie.key;Z!==null;){if(Z.key===ht)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){u(ee,Z.sibling),Ie=x(Z,ie.children||[]),Ie.return=ee,ee=Ie;break e}else{u(ee,Z);break}else a(ee,Z);Z=Z.sibling}Ie=Td(ie,ee.mode,Ie),Ie.return=ee,ee=Ie}return L(ee);case er:return ie=Et(ie),Zr(ee,Z,ie,Ie)}if(Vc(ie))return xn(ee,Z,ie,Ie);if(p(ie)){if(ht=p(ie),typeof ht!="function")throw Error(i(150));return ie=ht.call(ie),yl(ee,Z,ie,Ie)}if(typeof ie.then=="function")return Zr(ee,Z,Sn(ie),Ie);if(ie.$$typeof===Qs)return Zr(ee,Z,C(ee,ie),Ie);js(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(u(ee,Z.sibling),Ie=x(Z,ie),Ie.return=ee,ee=Ie):(u(ee,Z),Ie=Ed(ie,ee.mode,Ie),Ie.return=ee,ee=Ie),L(ee)):u(ee,Z)}return function(ee,Z,ie,Ie){try{dl=0;var ht=Zr(ee,Z,ie,Ie);return Za=null,ht}catch(pt){if(pt===ja||pt===Kc)throw pt;var sn=t(29,pt,null,ee.mode);return sn.lanes=Ie,sn.return=ee,sn}}}function Pr(){for(var s=$a,a=Zd=$a=0;aS?S:8);var L=ut.T,H={};ut.T=H,Jf(s,!1,a,u);try{var ae=x(),ge=ut.S;if(ge!==null&&ge(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ze=ve(ae,d);Ko(s,a,ze,vi(s))}else Ko(s,a,d,vi(s))}catch(Re){Ko(s,a,{then:function(){},status:"rejected",reason:Re},vi())}finally{Rn(S),L!==null&&H.types!==null&&(L.types=H.types),ut.T=L}}function e0(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:za},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function $f(){return N(Vr)}function t0(){return Ue().memoizedState}function n0(){return Ue().memoizedState}function _S(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=vi();s=gi(u);var d=Hi(a,s,u);d!==null&&(oi(d,a,u),$s(d,a,u)),a={cache:se()},s.payload=a;return}a=a.return}}function xS(s,a,u){var d=vi();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ac(s)?s0(a,u):(u=ki(s,a,u,d),u!==null&&(oi(u,s,d),r0(u,a,d)))}function i0(s,a,u){var d=vi();Ko(s,a,u,d)}function Ko(s,a,u,d){var x={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ac(s))s0(a,x);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,H=S(L,u);if(x.hasEagerState=!0,x.eagerState=H,bi(H,L))return Lr(s,a,x,0),jt===null&&Pr(),!1}catch{}if(u=ki(s,a,x,d),u!==null)return oi(u,s,d),r0(u,a,d),!0}return!1}function Jf(s,a,u,d){if(d={lane:2,revertLane:te(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ac(s)){if(a)throw Error(i(479))}else a=ki(s,u,d,2),a!==null&&oi(a,s,2)}function Ac(s){var a=s.alternate;return s===bt||a!==null&&a===bt}function s0(s,a){Ka=tu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function r0(s,a,u){if((u&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,u|=d,a.lanes=u,I(s,u)}}function Kf(s,a,u,d){a=s.memoizedState,u=u(d,a),u=u==null?a:Ad({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function a0(s,a,u,d,x,S,L){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!oe(u,d)||!oe(x,S):!0}function o0(s,a,u,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,d),a.state!==s&&Kd.enqueueReplaceState(a,a.state,null)}function Fr(s,a){var u=a;if("ref"in a){u={};for(var d in a)d!=="ref"&&(u[d]=a[d])}if(s=s.defaultProps){u===a&&(u=Ad({},u));for(var x in s)u[x]===void 0&&(u[x]=s[x])}return u}function Cc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function l0(s,a,u){try{var d=s.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Qf(s,a,u){return u=gi(u),u.tag=3,u.payload={element:null},u.callback=function(){Cc(s,a)},u}function c0(s){return s=gi(s),s.tag=3,s}function u0(s,a,u,d){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=d.value;s.payload=function(){return x(S)},s.callback=function(){l0(a,u,d)}}var L=u.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(s.callback=function(){l0(a,u,d),typeof x!="function"&&(or===null?or=new Set([this]):or.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function yS(s,a,u,d,x){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=u.alternate,a!==null&&Oe(a,u,x,!0),u=Si.current,u!==null){switch(u.tag){case 31:case 13:return $i===null?Oc():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=x,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([d]):a.add(d),Sd(s,d,x)),!1;case 22:return u.flags|=65536,d===Qc?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([d]):u.add(d)),Sd(s,d,x)),!1}throw Error(i(435,u.tag))}return Sd(s,d,x),Oc(),!1}if(Nt)return a=Si.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,d!==Wd&&(s=Error(i(422),{cause:d}),xe(ce(s,u)))):(d!==Wd&&(a=Error(i(423),{cause:d}),xe(ce(a,u))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,d=ce(d,u),x=Qf(s.stateNode,d,x),$o(s,x),an!==4&&(an=2)),!1;var S=Error(i(520),{cause:d});if(S=ce(S,u),vl===null?vl=[S]:vl.push(S),an!==4&&(an=2),a===null)return!0;d=ce(d,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=x&-x,u.lanes|=s,s=Qf(u.stateNode,d,s),$o(u,s),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(or===null||!or.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=c0(x),u0(x,s,u,d),$o(u,x),!1}u=u.return}while(u!==null);return!1}function Nn(s,a,u,d){a.child=s===null?$v(a,null,u,d):qr(a,s.child,u,d)}function h0(s,a,u,d,x){u=u.render;var S=a.ref;if("ref"in d){var L={};for(var H in d)H!=="ref"&&(L[H]=d[H])}else L=d;return Me(a),d=gt(s,a,u,L,S,x),H=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&H&&_e(a),a.flags|=1,Nn(s,a,d,x),a.child)}function f0(s,a,u,d,x){if(s===null){var S=u.type;return typeof S=="function"&&!Md(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,d0(s,a,S,d,x)):(s=zc(u.type,null,d,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(S=s.child,!ad(s,x)){var L=S.memoizedProps;if(u=u.compare,u=u!==null?u:oe,u(L,d)&&s.ref===a.ref)return Ms(s,a,x)}return a.flags|=1,s=ws(S,d),s.ref=a.ref,s.return=a,a.child=s}function d0(s,a,u,d,x){if(s!==null){var S=s.memoizedProps;if(oe(S,d)&&s.ref===a.ref)if(gn=!1,a.pendingProps=d=S,ad(s,x))(s.flags&131072)!==0&&(gn=!0);else return a.lanes=s.lanes,Ms(s,a,x)}return ed(s,a,u,d,x)}function p0(s,a,u,d){var x=d.children,S=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,s!==null){for(d=a.child=s.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~S}else d=0,a.child=null;return m0(s,a,S,u,d)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Be(a,S!==null?S.cachePool:null),S!==null?Ec(a,S):D(),K(a);else return d=a.lanes=536870912,m0(s,a,S!==null?S.baseLanes|u:u,u,d)}else S!==null?(Be(a,S.cachePool),Ec(a,S),Ne(),a.memoizedState=null):(s!==null&&Be(a,null),D(),Ne());return Nn(s,a,x,u),a.child}function Qo(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function m0(s,a,u,d,x){var S=be();return S=S===null?null:{parent:As?nn._currentValue:nn._currentValue2,pool:S},a.memoizedState={baseLanes:u,cachePool:S},s!==null&&Be(a,null),D(),K(a),s!==null&&Oe(s,a,d,!0),a.childLanes=x,null}function Rc(s,a){return a=Pc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function g0(s,a,u){return qr(a,s.child,null,u),s=Rc(a,a.pendingProps),s.flags|=2,Fe(a),a.memoizedState=null,s}function bS(s,a,u){var d=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(d.mode==="hidden")return s=Rc(a,d),a.lanes=536870912,Qo(null,s);if(Q(a),(s=tn)?(s=HM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return a.lanes=536870912,null}return Rc(a,d)}var S=s.memoizedState;if(S!==null){var L=S.dehydrated;if(Q(a),x)if(a.flags&256)a.flags&=-257,a=g0(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(gn||Oe(s,a,u,!1),x=(u&s.childLanes)!==0,gn||x){if(d=jt,d!==null&&(L=z(d,u),L!==0&&L!==S.retryLane))throw S.retryLane=L,Vi(s,L),oi(d,s,L),Qd;Oc(),a=g0(s,a,u)}else s=S.treeContext,Gn&&(tn=OM(L),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=Rc(a,d),a.flags|=4096;return a}return s=ws(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ic(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function ed(s,a,u,d,x){return Me(a),u=gt(s,a,u,d,void 0,x),d=Jt(),s!==null&&!gn?($t(s,a,x),Ms(s,a,x)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,x),a.child)}function v0(s,a,u,d,x,S){return Me(a),a.updateQueue=null,u=tt(a,d,u,x),yt(s),d=Jt(),s!==null&&!gn?($t(s,a,S),Ms(s,a,S)):(Nt&&d&&_e(a),a.flags|=1,Nn(s,a,u,S),a.child)}function _0(s,a,u,d,x){if(Me(a),a.stateNode===null){var S=Ha,L=u.contextType;typeof L=="object"&&L!==null&&(S=N(L)),S=new u(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Kd,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},Zs(a),L=u.contextType,S.context=typeof L=="object"&&L!==null?N(L):Ha,S.state=a.memoizedState,L=u.getDerivedStateFromProps,typeof L=="function"&&(Kf(a,u,L,d),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&Kd.enqueueReplaceState(S,S.state,null),Ur(a,d,S,x),Nr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){S=a.stateNode;var H=a.memoizedProps,ae=Fr(u,H);S.props=ae;var ge=S.context,ze=u.contextType;L=Ha,typeof ze=="object"&&ze!==null&&(L=N(ze));var Re=u.getDerivedStateFromProps;ze=typeof Re=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,ze||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||ge!==L)&&o0(a,S,d,L),sr=!1;var je=a.memoizedState;S.state=je,Ur(a,d,S,x),Nr(),ge=a.memoizedState,H||je!==ge||sr?(typeof Re=="function"&&(Kf(a,u,Re,d),ge=a.memoizedState),(ae=sr||a0(a,u,ae,d,je,ge,L))?(ze||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ge),S.props=d,S.state=ge,S.context=L,d=ae):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,La(s,a),L=a.memoizedProps,ze=Fr(u,L),S.props=ze,Re=a.pendingProps,je=S.context,ge=u.contextType,ae=Ha,typeof ge=="object"&&ge!==null&&(ae=N(ge)),H=u.getDerivedStateFromProps,(ge=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Re||je!==ae)&&o0(a,S,d,ae),sr=!1,je=a.memoizedState,S.state=je,Ur(a,d,S,x),Nr();var _t=a.memoizedState;L!==Re||je!==_t||sr||s!==null&&s.dependencies!==null&&nt(s.dependencies)?(typeof H=="function"&&(Kf(a,u,H,d),_t=a.memoizedState),(ze=sr||a0(a,u,ze,d,je,_t,ae)||s!==null&&s.dependencies!==null&&nt(s.dependencies))?(ge||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,_t,ae),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,_t,ae)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=_t),S.props=d,S.state=_t,S.context=ae,d=ze):(typeof S.componentDidUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===s.memoizedProps&&je===s.memoizedState||(a.flags|=1024),d=!1)}return S=d,Ic(s,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,s!==null&&d?(a.child=qr(a,s.child,null,x),a.child=qr(a,null,u,x)):Nn(s,a,u,x),a.memoizedState=S.state,s=a.child):s=Ms(s,a,x),s}function x0(s,a,u,d){return at(),a.flags|=256,Nn(s,a,u,d),a.child}function td(s){return{baseLanes:s,cachePool:Se()}}function nd(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Ei),s}function y0(s,a,u){var d=a.pendingProps,x=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),L&&(x=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(x?ne(a):Ne(),(s=tn)?(s=GM(s,Di),s!==null&&(a.memoizedState={dehydrated:s,treeContext:tr!==null?{id:os,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},u=dv(s),u.return=a,a.child=u,Fn=a,tn=null)):s=null,s===null)throw $e(a);return Od(s)?a.lanes=32:a.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ne(),x=a.mode,H=Pc({mode:"hidden",children:H},x),d=zr(d,x,u,null),H.return=a,d.return=a,H.sibling=d,a.child=H,d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(null,d)):(ne(a),id(a,H))}var ae=s.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(S)a.flags&256?(ne(a),a.flags&=-257,a=sd(s,a,u)):a.memoizedState!==null?(Ne(),a.child=s.child,a.flags|=128,a=null):(Ne(),H=d.fallback,x=a.mode,d=Pc({mode:"visible",children:d.children},x),H=zr(H,x,u,null),H.flags|=2,d.return=a,H.return=a,d.sibling=H,a.child=d,qr(a,s.child,null,u),d=a.child,d.memoizedState=td(u),d.childLanes=nd(s,L,u),a.memoizedState=ep,a=Qo(null,d));else if(ne(a),Od(H))L=IM(H).digest,d=Error(i(419)),d.stack="",d.digest=L,xe({value:d,source:null,stack:null}),a=sd(s,a,u);else if(gn||Oe(s,a,u,!1),L=(u&s.childLanes)!==0,gn||L){if(L=jt,L!==null&&(d=z(L,u),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Vi(s,d),oi(L,s,d),Qd;Fd(H)||Oc(),a=sd(s,a,u)}else Fd(H)?(a.flags|=192,a.child=s.child,a=null):(s=ae.treeContext,Gn&&(tn=BM(H),Fn=a,Nt=!0,ir=null,Di=!1,s!==null&&ot(a,s)),a=id(a,d.children),a.flags|=4096);return a}return x?(Ne(),H=d.fallback,x=a.mode,ae=s.child,S=ae.sibling,d=ws(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.subtreeFlags&65011712,S!==null?H=ws(S,H):(H=zr(H,x,u,null),H.flags|=2),H.return=a,d.return=a,d.sibling=H,a.child=d,Qo(null,d),d=a.child,H=s.child.memoizedState,H===null?H=td(u):(x=H.cachePool,x!==null?(ae=As?nn._currentValue:nn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Se(),H={baseLanes:H.baseLanes|u,cachePool:x}),d.memoizedState=H,d.childLanes=nd(s,L,u),a.memoizedState=ep,Qo(s.child,d)):(ne(a),u=s.child,s=u.sibling,u=ws(u,{mode:"visible",children:d.children}),u.return=a,u.sibling=null,s!==null&&(L=a.deletions,L===null?(a.deletions=[s],a.flags|=16):L.push(s)),a.child=u,a.memoizedState=null,u)}function id(s,a){return a=Pc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Pc(s,a){return s=t(22,s,null,a),s.lanes=0,s}function sd(s,a,u){return qr(a,s.child,null,u),s=id(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function b0(s,a,u){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),B(s.return,a,u)}function rd(s,a,u,d,x,S){var L=s.memoizedState;L===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:x,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=u,L.tailMode=x,L.treeForkCount=S)}function S0(s,a,u){var d=a.pendingProps,x=d.revealOrder,S=d.tail;d=d.children;var L=hn.current,H=(L&2)!==0;if(H?(L=L&1|2,a.flags|=128):L&=1,_(hn,L),Nn(s,a,d,u),d=Nt?ul:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&b0(s,u,a);else if(s.tag===19)b0(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)s=u.alternate,s!==null&&Ve(s)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),rd(a,!1,x,u,S,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ve(s)===null){a.child=x;break}s=x.sibling,x.sibling=u,u=x,x=s}rd(a,!0,u,null,S,d);break;case"together":rd(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ms(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),ar|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Oe(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,u=ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function ad(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&nt(s)))}function SS(s,a,u){switch(a.tag){case 3:Tt(a,a.stateNode.containerInfo),fe(a,nn,s.memoizedState.cache),at();break;case 27:case 5:Ae(a);break;case 4:Tt(a,a.stateNode.containerInfo);break;case 10:fe(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Q(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ne(a),a.flags|=128,null):(u&a.child.childLanes)!==0?y0(s,a,u):(ne(a),s=Ms(s,a,u),s!==null?s.sibling:null);ne(a);break;case 19:var x=(s.flags&128)!==0;if(d=(u&a.childLanes)!==0,d||(Oe(s,a,u,!1),d=(u&a.childLanes)!==0),x){if(d)return S0(s,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(hn,hn.current),d)break;return null;case 22:return a.lanes=0,p0(s,a,u,a.pendingProps);case 24:fe(a,nn,s.memoizedState.cache)}return Ms(s,a,u)}function M0(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)gn=!0;else{if(!ad(s,u)&&(a.flags&128)===0)return gn=!1,SS(s,a,u);gn=(s.flags&131072)!==0}else gn=!1,Nt&&(a.flags&1048576)!==0&&me(a,ul,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=Et(a.elementType),a.type=s,typeof s=="function")Md(s)?(d=Fr(s,d),a.tag=1,a=_0(null,a,s,d,u)):(a.tag=0,a=ed(null,a,s,d,u));else{if(s!=null){var x=s.$$typeof;if(x===Rd){a.tag=11,a=h0(null,a,s,d,u);break e}else if(x===Ld){a.tag=14,a=f0(null,a,s,d,u);break e}}throw a=g(s)||s,Error(i(306,a,""))}}return a;case 0:return ed(s,a,a.type,a.pendingProps,u);case 1:return d=a.type,x=Fr(d,a.pendingProps),_0(s,a,d,x,u);case 3:e:{if(Tt(a,a.stateNode.containerInfo),s===null)throw Error(i(387));var S=a.pendingProps;x=a.memoizedState,d=x.element,La(s,a),Ur(a,S,null,u);var L=a.memoizedState;if(S=L.cache,fe(a,nn,S),S!==x.cache&&Qe(a,[nn],u,!0),Nr(),S=L.element,Gn&&x.isDehydrated)if(x={element:S,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=x0(s,a,S,u);break e}else if(S!==d){d=ce(Error(i(424)),a),xe(d),a=x0(s,a,S,u);break e}else for(Gn&&(tn=FM(a.stateNode.containerInfo),Fn=a,Nt=!0,ir=null,Di=!0),u=$v(a,null,S,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(at(),S===d){a=Ms(s,a,u);break e}Nn(s,a,S,u)}a=a.child}return a;case 26:if(Zi)return Ic(s,a),s===null?(u=Fv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Nt||(a.stateNode=c1(a.type,a.pendingProps,nr.current,a)):a.memoizedState=Fv(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(Mn)return Ae(a),s===null&&Mn&&Nt&&(d=a.stateNode=Hv(a.type,a.pendingProps,nr.current,Un.current,!1),Fn=a,Di=!0,tn=zM(a.type,d,tn)),Nn(s,a,a.pendingProps.children,u),Ic(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&(a1(a.type,a.pendingProps,Un.current),(x=d=tn)&&(d=kM(d,a.type,a.pendingProps,Di),d!==null?(a.stateNode=d,Fn=a,tn=UM(d),Di=!1,x=!0):x=!1),x||$e(a)),Ae(a),x=a.type,S=a.pendingProps,L=s!==null?s.memoizedProps:null,d=S.children,Hc(x,S)?d=null:L!==null&&Hc(x,L)&&(a.flags|=32),a.memoizedState!==null&&(x=gt(s,a,Gt,null,null,u),As?Vr._currentValue=x:Vr._currentValue2=x),Ic(s,a),Nn(s,a,d,u),a.child;case 6:return s===null&&Nt&&(o1(a.pendingProps,Un.current),(s=u=tn)&&(u=VM(u,a.pendingProps,Di),u!==null?(a.stateNode=u,Fn=a,tn=null,s=!0):s=!1),s||$e(a)),null;case 13:return y0(s,a,u);case 4:return Tt(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=qr(a,null,d,u):Nn(s,a,d,u),a.child;case 11:return h0(s,a,a.type,a.pendingProps,u);case 7:return Nn(s,a,a.pendingProps,u),a.child;case 8:return Nn(s,a,a.pendingProps.children,u),a.child;case 12:return Nn(s,a,a.pendingProps.children,u),a.child;case 10:return d=a.pendingProps,fe(a,a.type,d.value),Nn(s,a,d.children,u),a.child;case 9:return x=a.type._context,d=a.pendingProps.children,Me(a),x=N(x),d=d(x),a.flags|=1,Nn(s,a,d,u),a.child;case 14:return f0(s,a,a.type,a.pendingProps,u);case 15:return d0(s,a,a.type,a.pendingProps,u);case 19:return S0(s,a,u);case 31:return bS(s,a,u);case 22:return p0(s,a,u,a.pendingProps);case 24:return Me(a),d=N(nn),s===null?(x=be(),x===null&&(x=jt,S=se(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:d,cache:x},Zs(a),fe(a,nn,x)):((s.lanes&u)!==0&&(La(s,a),Ur(a,null,null,u),Nr()),x=s.memoizedState,S=a.memoizedState,x.parent!==d?(x={parent:d,cache:d},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),fe(a,nn,d)):(d=S.cache,fe(a,nn,d),d!==x.cache&&Qe(a,[nn],u,!0))),Nn(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function qi(s){s.flags|=4}function Lc(s){as&&(s.flags|=8)}function E0(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function od(s,a,u,d){if(Hn)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Nd(s,u.stateNode);else if(!(u.tag===4||Mn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(as)for(var x=a.child;x!==null;){if(x.tag===5){var S=x.stateNode;u&&d&&(S=Pv(S,x.type,x.memoizedProps)),Nd(s,S)}else if(x.tag===6)S=x.stateNode,u&&d&&(S=Lv(S,x.memoizedProps)),Nd(s,S);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)S=x.child,S!==null&&(S.return=x),od(s,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function T0(s,a,u,d){var x=!1;if(as)for(var S=a.child;S!==null;){if(S.tag===5){var L=S.stateNode;u&&d&&(L=Pv(L,S.type,S.memoizedProps)),Rv(s,L)}else if(S.tag===6)L=S.stateNode,u&&d&&(L=Lv(L,S.memoizedProps)),Rv(s,L);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)x=S.child,x!==null&&(x.return=S),T0(s,S,!0,!0),x=!0;else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===a)break;for(;S.sibling===null;){if(S.return===null||S.return===a)return x;S=S.return}S.sibling.return=S.return,S=S.sibling}return x}function w0(s,a){if(as&&E0(s,a)){s=a.stateNode;var u=s.containerInfo,d=Cv();T0(d,a,!1,!1),s.pendingChildren=d,qi(a),RM(u,d)}}function ld(s,a,u,d){if(Hn)s.memoizedProps!==d&&qi(a);else if(as){var x=s.stateNode,S=s.memoizedProps;if((s=E0(s,a))||S!==d){var L=Un.current;S=CM(x,u,S,d,!s,null),S===x?a.stateNode=x:(Lc(a),Mv(S,u,d,L)&&qi(a),a.stateNode=S,s&&od(S,a,!1,!1))}else a.stateNode=x}}function cd(s,a,u,d,x){if((s.mode&32)!==0&&(u===null?tM(a,d):nM(a,u,d))){if(s.flags|=16777216,(x&335544128)===x||Ud(a,d))if(Tv(s.stateNode,a,d))s.flags|=8192;else if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function A0(s,a){if(h1(a)){if(s.flags|=16777216,!Vv(a))if(K0())s.flags|=8192;else throw Xr=Qc,jd}else s.flags&=-16777217}function Dc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?w():536870912,s.lanes|=a,no|=a)}function el(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Kt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,d=0;if(a)for(var x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)u|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=d,s.childLanes=u,a}function MS(s,a,u){var d=a.pendingProps;switch(qe(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return u=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Pe(nn),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wt(a)?qi(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),w0(s,a),Kt(a),null;case 26:if(Zi){var x=a.type,S=a.memoizedState;return s===null?(qi(a),S!==null?(Kt(a),A0(a,S)):(Kt(a),cd(a,x,null,d,u))):S?S!==s.memoizedState?(qi(a),Kt(a),A0(a,S)):(Kt(a),a.flags&=-16777217):(S=s.memoizedProps,Hn?S!==d&&qi(a):ld(s,a,x,d),Kt(a),cd(a,x,S,d,u)),null}case 27:if(Mn){if(Ce(a),u=nr.current,x=a.type,s!==null&&a.stateNode!=null)Hn?s.memoizedProps!==d&&qi(a):ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}s=Un.current,wt(a)?et(a,s):(s=Hv(x,d,u,s,!0),a.stateNode=s,qi(a))}return Kt(a),null}case 5:if(Ce(a),x=a.type,s!==null&&a.stateNode!=null)ld(s,a,x,d);else{if(!d){if(a.stateNode===null)throw Error(i(166));return Kt(a),null}if(S=Un.current,wt(a))et(a,S),e1(a.stateNode,x,d,S)&&(a.flags|=64);else{var L=YS(x,d,nr.current,S,a);Lc(a),od(L,a,!1,!1),a.stateNode=L,Mv(L,x,d,S)&&qi(a)}}return Kt(a),cd(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,Hn?u!==d&&qi(a):as&&(u!==d?(s=nr.current,u=Un.current,Lc(a),a.stateNode=Ev(d,s,u,a)):a.stateNode=s.stateNode);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=nr.current,u=Un.current,wt(a)){if(!Gn)throw Error(i(176));if(s=a.stateNode,u=a.memoizedProps,d=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}XM(s,u,a,d)||$e(a,!0)}else Lc(a),a.stateNode=Ev(d,s,u,a)}return Kt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(d=wt(a),u!==null){if(s===null){if(!d)throw Error(i(318));if(!Gn)throw Error(i(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));qM(s,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),s=!1}else u=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Fe(a),a):(Fe(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Kt(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=wt(a),d!==null&&d.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(!Gn)throw Error(i(344));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));YM(x,a)}else at(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),x=!1}else x=de(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Fe(a),a):(Fe(a),null)}return Fe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=d!==null,s=s!==null&&s.memoizedState!==null,u&&(d=a.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==x&&(d.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Dc(a,a.updateQueue),Kt(a),null);case 4:return le(),w0(s,a),s===null&&JS(a.stateNode.containerInfo),Kt(a),null;case 10:return Pe(a.type),Kt(a),null;case 19:if(v(hn),d=a.memoizedState,d===null)return Kt(a),null;if(x=(a.flags&128)!==0,S=d.rendering,S===null)if(x)el(d,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(S=Ve(s),S!==null){for(a.flags|=128,el(d,!1),s=S.updateQueue,a.updateQueue=s,Dc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)fv(u,s),u=u.sibling;return _(hn,hn.current&1|2),Nt&&Ee(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&li()>_l&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304)}else{if(!x)if(s=Ve(S),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Dc(a,s),el(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!Nt)return Kt(a),null}else 2*li()-d.renderingStartTime>_l&&u!==536870912&&(a.flags|=128,x=!0,el(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(s=d.last,s!==null?s.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=li(),s.sibling=null,u=hn.current,_(hn,x?u&1|2:u&1),Nt&&Ee(a,d.treeForkCount),s):(Kt(a),null);case 22:case 23:return Fe(a),Y(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(u&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),u=a.updateQueue,u!==null&&Dc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==u&&(a.flags|=2048),s!==null&&v(Wr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Pe(nn),Kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ES(s,a){switch(qe(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Pe(nn),le(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(Fe(a),a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Fe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));at()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return v(hn),null;case 4:return le(),null;case 10:return Pe(a.type),null;case 22:case 23:return Fe(a),Y(),s!==null&&v(Wr),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Pe(nn),null;case 25:return null;default:return null}}function C0(s,a){switch(qe(a),a.tag){case 3:Pe(nn),le();break;case 26:case 27:case 5:Ce(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fe(a);break;case 13:Fe(a);break;case 19:v(hn);break;case 10:Pe(a.type);break;case 22:case 23:Fe(a),Y(),s!==null&&v(Wr);break;case 24:Pe(nn)}}function tl(s,a){try{var u=a.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var x=d.next;u=x;do{if((u.tag&s)===s){d=void 0;var S=u.create,L=u.inst;d=S(),L.destroy=d}u=u.next}while(u!==x)}}catch(H){zt(a,a.return,H)}}function Js(s,a,u){try{var d=a.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var S=x.next;d=S;do{if((d.tag&s)===s){var L=d.inst,H=L.destroy;if(H!==void 0){L.destroy=void 0,x=a;var ae=u,ge=H;try{ge()}catch(ze){zt(x,ae,ze)}}}d=d.next}while(d!==S)}}catch(ze){zt(a,a.return,ze)}}function R0(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Mc(a,u)}catch(d){zt(s,s.return,d)}}}function I0(s,a,u){u.props=Fr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(d){zt(s,a,d)}}function nl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var d=al(s.stateNode);break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof u=="function"?s.refCleanup=u(d):u.current=d}}catch(x){zt(s,a,x)}}function rs(s,a){var u=s.ref,d=s.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(x){zt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){zt(s,a,x)}else u.current=null}function P0(s){var a=s.type,u=s.memoizedProps,d=s.stateNode;try{vM(d,a,u,s)}catch(x){zt(s,s.return,x)}}function ud(s,a,u){try{_M(s.stateNode,s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function L0(s){return s.tag===5||s.tag===3||(Zi?s.tag===26:!1)||(Mn?s.tag===27&&ka(s.type):!1)||s.tag===4}function hd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||L0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(Mn&&s.tag===27&&ka(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fd(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?yM(u,s,a):mM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(fd(s,a,u),s=s.sibling;s!==null;)fd(s,a,u),s=s.sibling}function Nc(s,a,u){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?xM(u,s,a):pM(u,s);else if(d!==4&&(Mn&&d===27&&ka(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nc(s,a,u),s=s.sibling;s!==null;)Nc(s,a,u),s=s.sibling}function D0(s,a,u){s=s.containerInfo;try{Iv(s,u)}catch(d){zt(a,a.return,d)}}function N0(s){var a=s.stateNode,u=s.memoizedProps;try{d1(s.type,u,a,s)}catch(d){zt(s,s.return,d)}}function TS(s,a){for(XS(s.containerInfo),In=a;In!==null;)if(s=In,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,In=a;else for(;In!==null;){s=In;var u=s.alternate;switch(a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(var d=0;d";case su:return":has("+(_d(s)||"")+")";case ru:return'[role="'+s.value+'"]';case ou:return'"'+s.value+'"';case au:return'[data-testname="'+s.value+'"]';default:throw Error(i(365))}}function q0(s,a){var u=[];s=[s,0];for(var d=0;du?32:u;u=ut.T;var x=Cs();try{Rn(d),ut.T=null,d=ap,ap=null;var S=lr,L=Ds;if(En=0,io=lr=null,Ds=0,(It&6)!==0)throw Error(i(331));var H=It;if(It|=4,W0(S.current),V0(S,S.current,L,d),It=H,Te(0,!1),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(cl,S)}catch{}return!0}finally{Rn(x),ut.T=u,lv(s,a)}}function uv(s,a,u){a=ce(u,a),a=Qf(s.stateNode,a,2),s=Hi(s,a,2),s!==null&&(R(s,2),He(s))}function zt(s,a,u){if(s.tag===3)uv(s,s,u);else for(;a!==null;){if(a.tag===3){uv(a,s,u);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(or===null||!or.has(d))){s=ce(u,s),u=c0(2),d=Hi(a,u,2),d!==null&&(u0(u,d,a,s),R(d,2),He(d));break}}a=a.return}}function Sd(s,a,u){var d=s.pingCache;if(d===null){d=s.pingCache=new C1;var x=new Set;d.set(a,x)}else x=d.get(a),x===void 0&&(x=new Set,d.set(a,x));x.has(u)||(np=!0,x.add(u),s=PS.bind(null,s,a,u),a.then(s,s))}function PS(s,a,u){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,jt===s&&(Lt&u)===u&&(an===4||an===3&&(Lt&62914560)===Lt&&300>li()-lu?(It&2)===0&&Ua(s,0):ip|=u,no===Lt&&(no=0)),He(s)}function hv(s,a){a===0&&(a=w()),s=Vi(s,a),s!==null&&(R(s,a),He(s))}function LS(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),hv(s,u)}function DS(s,a){var u=0;switch(s.tag){case 31:case 13:var d=s.stateNode,x=s.memoizedState;x!==null&&(u=x.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),hv(s,u)}function NS(s,a){return qc(s,a)}function US(s,a,u,d){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Md(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ws(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function fv(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function zc(s,a,u,d,x,S){var L=0;if(d=s,typeof s=="function")Md(s)&&(L=1);else if(typeof s=="string")L=Zi&&Mn?Uv(s,u,Un.current)?26:Wv(s)?27:5:Zi?Uv(s,u,Un.current)?26:5:Mn&&Wv(s)?27:5;else e:switch(s){case Dd:return s=t(31,u,a,x),s.elementType=Dd,s.lanes=S,s;case Ba:return zr(u.children,x,S,a);case xv:L=8,x|=24;break;case Cd:return s=t(12,u,a,x|2),s.elementType=Cd,s.lanes=S,s;case Id:return s=t(13,u,a,x),s.elementType=Id,s.lanes=S,s;case Pd:return s=t(19,u,a,x),s.elementType=Pd,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Qs:L=10;break e;case yv:L=9;break e;case Rd:L=11;break e;case Ld:L=14;break e;case er:L=16,d=null;break e}L=29,u=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=t(L,u,a,x),a.elementType=s,a.type=d,a.lanes=S,a}function zr(s,a,u,d){return s=t(7,s,d,a),s.lanes=u,s}function Ed(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function dv(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Td(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function FS(s,a,u,d,x,S,L,H,ae){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=kr,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function pv(s,a,u,d,x,S,L,H,ae,ge,ze,Re){return s=new FS(s,a,u,L,ae,ge,ze,Re,H),a=1,S===!0&&(a|=24),S=t(3,null,null,a),s.current=S,S.stateNode=s,a=se(),a.refCount++,s.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:u,cache:a},Zs(S),s}function mv(s){return s?(s=Ha,s):Ha}function gv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:al(s.stateNode)}function vv(s,a,u,d,x,S){x=mv(x),d.context===null?d.context=x:d.pendingContext=x,d=gi(a),d.payload={element:u},S=S===void 0?null:S,S!==null&&(d.callback=S),u=Hi(s,d,a),u!==null&&(oi(u,s,a),$s(u,s,a))}function _v(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u=ge&&S>=Re&&x<=ze&&L<=je){s.splice(a,1);break}else if(d!==ge||u.width!==ae.width||jeL){if(!(S!==Re||u.height!==ae.height||zex)){ge>d&&(ae.width+=ge-d,ae.x=d),zeS&&(ae.height+=Re-S,ae.y=S),jeu&&(u=H)),H ")+` + +No matching component was found for: + `)+s.join(" > ")}return null},Rt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return al(s.child.stateNode);default:return s.child.stateNode}},Rt.injectIntoDevTools=function(){var s={bundleType:0,version:VS,rendererPackageName:HS,currentDispatcherRef:ut,reconcilerVersion:"19.2.0"};if(Sv!==null&&(s.rendererConfig=Sv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{cl=a.inject(s),yi=a}catch{}s=!!a.checkDCE}}return s},Rt.isAlreadyRendering=function(){return(It&6)!==0},Rt.observeVisibleRects=function(s,a,u,d){if(!ol)throw Error(i(363));s=xd(s,a);var x=dM(s,u,d).disconnect;return{disconnect:function(){x()}}},Rt.shouldError=function(){return null},Rt.shouldSuspend=function(){return!1},Rt.startHostTransition=function(s,a,u,d){if(s.tag!==5)throw Error(i(476));var x=e0(s).queue;Qg(s,x,a,za,u===null?n:function(){var S=e0(s);return S.next===null&&(S=s.alternate.memoizedState),Ko(s,S.next.queue,{},vi()),u(d)})},Rt.updateContainer=function(s,a,u,d){var x=a.current,S=vi();return vv(x,S,s,a,u,d),S},Rt.updateContainerSync=function(s,a,u,d){return vv(a.current,2,s,a,u,d),2},Rt},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(Hx)),Hx.exports}var Wx;function sL(){return Wx||(Wx=1,Vx.exports=iL()),Vx.exports}var rL=sL();const aL=nL(rL);function oL(r){const e=aL(r);return e.injectIntoDevTools(),e}const lS=0,Ho={},lL=/^three(?=[A-Z])/,Wf=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let cL=0;const uL=r=>typeof r=="function";function hL(r){if(uL(r)){const e=`${cL++}`;return Ho[e]=r,e}else Object.assign(Ho,r)}function cS(r,e){const t=Wf(r),n=Ho[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function fL(r,e,t){var n;return r=Wf(r)in Ho?r:r.replace(lL,""),cS(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,tf(e.object,t,r,e)}function dL(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?sf(r.parent,r):ei(r.object)&&(r.object.visible=!1),r.isHidden=!0,jo(r)}}function uS(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?nf(r.parent,r):ei(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,jo(r)}}function Pg(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var i,o;const l=Ho[Wf(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(xr(e.object,e.props),e.props.attach)nf(r,e);else if(ei(e.object)&&ei(r.object)){const l=r.object.children.indexOf(t?.object);if(t&&l!==-1){const c=r.object.children.indexOf(e.object);if(c!==-1){r.object.children.splice(c,1);const h=c{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Rm(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?sf(r,e):ei(e.object)&&ei(r.object)&&(r.object.remove(e.object),qP(eS(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let o=e.children.length-1;o>=0;o--){const l=e.children[o];Rm(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&hS(e.object),t===void 0&&jo(e)}function pL(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lh=[];function mL(){for(const[t]of lh){const n=t.parent;if(n){t.props.attach?sf(n,t):ei(t.object)&&ei(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?sf(t,i):ei(i.object)&&ei(t.object)&&t.object.remove(i.object)}t.isHidden&&uS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&hS(t.object)}for(const[t,n,i]of lh){t.props=n;const o=t.parent;if(o){var r,e;const l=Ho[Wf(t.type)];t.object=(r=t.props.object)!=null?r:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pL(i,t.object),xr(t.object,t.props),t.props.attach?nf(o,t):ei(t.object)&&ei(o.object)&&o.object.add(t.object);for(const c of t.children)c.props.attach?nf(t,c):ei(c.object)&&ei(t.object)&&t.object.add(c.object);jo(t)}}lh.length=0}const nm=()=>{},qx={};let ih=lS;const gL=0,vL=4,rf=oL({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:fL,removeChild:Rm,appendChild:tm,appendInitialChild:tm,insertBefore:Xx,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||tm(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Rm(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||Xx(n,e,t)},getRootHostContext:()=>qx,getChildHostContext:()=>qx,commitUpdate(r,e,t,n,i){var o,l,c;cS(e,n);let h=!1;if((r.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(h=!0),h)lh.push([r,{...n},i]);else{const p=GP(r,n);Object.keys(p).length&&(Object.assign(r.props,p),xr(r.object,p))}(i.sibling===null||(i.flags&vL)===gL)&&mL()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>tf(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dL,unhideInstance:uS,createTextInstance:nm,hideTextInstance:nm,unhideTextInstance:nm,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ft.createContext(null),setCurrentUpdatePriority(r){ih=r},getCurrentUpdatePriority(){return ih},resolveUpdatePriority(){var r;if(ih!==lS)return ih;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eL;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KP;default:return QP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tL.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),Aa=new Map,Ao={objects:"shallow",strict:!1};function _L(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:o}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function xL(r){const e=Aa.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,o=n||jP(Lm,jx),l=t||rf.createContainer(o,JP,null,!1,null,"",i,i,i,null);e||Aa.set(r,{fiber:l,store:o});let c,h,f=!1,p=null;return{async configure(g={}){let m;p=new Promise(me=>m=me);let{gl:v,size:_,scene:E,events:b,onCreated:y,shadows:M=!1,linear:T=!1,flat:w=!1,legacy:P=!1,orthographic:R=!1,frameloop:U="always",dpr:A=[1,2],performance:I,raycaster:z,camera:O,onPointerMissed:X}=g,G=o.getState(),j=G.gl;if(!G.gl){const me={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},_e=typeof v=="function"?await v(me):v;zx(_e)?j=_e:j=new Yb({...me,...v}),G.set({gl:j})}let q=G.raycaster;q||G.set({raycaster:q=new Mg});const{params:$,...J}=z||{};if(en.equ(J,q,Ao)||xr(q,{...J}),en.equ($,q.params,Ao)||xr(q,{params:{...q.params,...$}}),!G.camera||G.camera===h&&!en.equ(h,O,Ao)){h=O;const me=O?.isCamera,_e=me?O:R?new Ws(0,0,0,0,.1,1e3):new dn(75,0,.1,1e3);me||(_e.position.z=5,O&&(xr(_e,O),_e.manual||("aspect"in O||"left"in O||"right"in O||"bottom"in O||"top"in O)&&(_e.manual=!0,_e.updateProjectionMatrix())),!G.camera&&!(O!=null&&O.rotation)&&_e.lookAt(0,0,0)),G.set({camera:_e}),q.camera=_e}if(!G.scene){let me;E!=null&&E.isScene?(me=E,tf(me,o,"",{})):(me=new $m,tf(me,o,"",{}),E&&xr(me,E)),G.set({scene:me})}b&&!G.events.handlers&&G.set({events:b(o)});const pe=_L(r,_);if(en.equ(pe,G.size,Ao)||G.setSize(pe.width,pe.height,pe.top,pe.left),A&&G.viewport.dpr!==nS(A)&&G.setDpr(A),G.frameloop!==U&&G.setFrameloop(U),G.onPointerMissed||G.set({onPointerMissed:X}),I&&!en.equ(I,G.performance,Ao)&&G.set(me=>({performance:{...me.performance,...I}})),!G.xr){var ce;const me=(ot,Tt)=>{const le=o.getState();le.frameloop!=="never"&&jx(ot,!0,le,Tt)},_e=()=>{const ot=o.getState();ot.gl.xr.enabled=ot.gl.xr.isPresenting,ot.gl.xr.setAnimationLoop(ot.gl.xr.isPresenting?me:null),ot.gl.xr.isPresenting||Lm(ot)},qe={connect(){const ot=o.getState().gl;ot.xr.addEventListener("sessionstart",_e),ot.xr.addEventListener("sessionend",_e)},disconnect(){const ot=o.getState().gl;ot.xr.removeEventListener("sessionstart",_e),ot.xr.removeEventListener("sessionend",_e)}};typeof((ce=j.xr)==null?void 0:ce.addEventListener)=="function"&&qe.connect(),G.set({xr:qe})}if(j.shadowMap){const me=j.shadowMap.enabled,_e=j.shadowMap.type;if(j.shadowMap.enabled=!!M,en.boo(M))j.shadowMap.type=Ol;else if(en.str(M)){var Ee;const qe={basic:iy,percentage:Lo,soft:Ol,variance:pa};j.shadowMap.type=(Ee=qe[M])!=null?Ee:Ol}else en.obj(M)&&Object.assign(j.shadowMap,M);(me!==j.shadowMap.enabled||_e!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Dt.enabled=!P,f||(j.outputColorSpace=T?Er:Yn,j.toneMapping=w?Fi:lf),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==w&&G.set(()=>({flat:w})),v&&!en.fun(v)&&!zx(v)&&!en.equ(v,j,Ao)&&xr(j,v),c=y,f=!0,m(),this},render(g){return!f&&!p&&this.configure(),p.then(()=>{rf.updateContainer(On.jsx(yL,{store:o,children:g,onCreated:c,rootElement:r}),l,null,()=>{})}),o},unmount(){fS(r)}}}function yL({store:r,children:e,onCreated:t,rootElement:n}){return yc(()=>{const i=r.getState();i.set(o=>({internal:{...o.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),On.jsx(Rg.Provider,{value:r,children:e})}function fS(r,e){const t=Aa.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),rf.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var o,l,c,h;i.events.disconnect==null||i.events.disconnect(),(o=i.gl)==null||(l=o.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),kP(i.scene),Aa.delete(r)}catch{}},500)})}}function GL(r,e,t){return On.jsx(bL,{children:r,container:e,state:t})}function bL({state:r={},children:e,container:t}){const{events:n,size:i,...o}=r,l=Ig(),[c]=ft.useState(()=>new Mg),[h]=ft.useState(()=>new ue),f=Cg((g,m)=>{let v;if(m.camera&&i){const _=m.camera;v=g.viewport.getCurrentViewport(_,new F,i),_!==g.camera&&sS(_,i)}return{...g,...m,scene:t,raycaster:c,pointer:h,mouse:h,previousRoot:l,events:{...g.events,...m.events,...n},size:{...g.size,...i},viewport:{...g.viewport,...v},setEvents:_=>m.set(E=>({...E,events:{...E.events,..._}}))}}),p=ft.useMemo(()=>{const g=jb((v,_)=>({...o,set:v,get:_})),m=v=>g.setState(_=>f.current(v,_));return m(l.getState()),l.subscribe(m),g},[l,t]);return On.jsx(On.Fragment,{children:rf.createPortal(On.jsx(Rg.Provider,{value:p,children:e}),p,null)})}const SL=new Set,ML=new Set,EL=new Set;function im(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function jl(r,e){switch(r){case"before":return im(SL,e);case"after":return im(ML,e);case"tail":return im(EL,e)}}let sm,rm;function Im(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),sm=e.internal.subscribers;for(let i=0;i0)&&!((e=Co.gl.xr)!=null&&e.isPresenting)&&(am+=Im(r,Co))}if(Pm=!1,jl("after",r),am===0)return jl("tail",r),af=!1,cancelAnimationFrame(Yx)}function Lm(r,e=1){var t;if(!r)return Aa.forEach(n=>Lm(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):Pm?r.internal.frames=2:r.internal.frames=1,af||(af=!0,requestAnimationFrame(dS)))}function jx(r,e=!0,t,n){if(e&&jl("before",r),t)Im(r,t,n);else for(const i of Aa.values())Im(r,i.store.getState());e&&jl("after",r)}const om={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function TL(r){const{handlePointer:e}=YP(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(om).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=r.getState();if(i.disconnect==null||i.disconnect(),n(o=>({events:{...o.events,connected:t}})),i.handlers)for(const o in i.handlers){const l=i.handlers[o],[c,h]=om[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const o=n.handlers[i],[l]=om[i];n.connected.removeEventListener(l,o)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function Zx(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function wL({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ft.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ft.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=ft.useRef(!1);ft.useEffect(()=>(p.current=!0,()=>{p.current=!1}));const[g,m,v]=ft.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I}=c.current.element.getBoundingClientRect(),z={left:M,top:T,width:w,height:P,bottom:R,right:U,x:A,y:I};c.current.element instanceof HTMLElement&&n&&(z.height=c.current.element.offsetHeight,z.width=c.current.element.offsetWidth),Object.freeze(z),p.current&&!IL(c.current.lastBounds,z)&&l(c.current.lastBounds=z)};return[y,f?Zx(y,f):y,h?Zx(y,h):y]},[l,n,h,f]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function E(){c.current.element&&(c.current.resizeObserver=new i(v),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=pS(y),E())};return CL(v,!!e),AL(m),ft.useEffect(()=>{_(),E()},[e,v,m]),ft.useEffect(()=>_,[]),[b,o,g]}function AL(r){ft.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function CL(r,e){ft.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function pS(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(o=>o==="auto"||o==="scroll")&&e.push(r),[...e,...pS(r.parentElement)]}const RL=["x","y","top","bottom","left","right","width","height"],IL=(r,e)=>RL.every(t=>r[t]===e[t]);function PL({ref:r,children:e,fallback:t,resize:n,style:i,gl:o,events:l=TL,eventSource:c,eventPrefix:h,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,scene:T,onPointerMissed:w,onCreated:P,...R}){ft.useMemo(()=>hL(pP),[]);const U=FP(),[A,I]=wL({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=ft.useRef(null),O=ft.useRef(null);ft.useImperativeHandle(r,()=>z.current);const X=Cg(w),[G,j]=ft.useState(!1),[q,$]=ft.useState(!1);if(G)throw G;if(q)throw q;const J=ft.useRef(null);yc(()=>{const ce=z.current;if(I.width>0&&I.height>0&&ce){J.current||(J.current=xL(ce));async function Ee(){await J.current.configure({gl:o,scene:T,events:l,shadows:f,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:E,performance:b,raycaster:y,camera:M,size:I,onPointerMissed:(...me)=>X.current==null?void 0:X.current(...me),onCreated:me=>{me.events.connect==null||me.events.connect(c?NP(c)?c.current:c:O.current),h&&me.setEvents({compute:(_e,qe)=>{const ot=_e[h+"X"],Tt=_e[h+"Y"];qe.pointer.set(ot/qe.size.width*2-1,-(Tt/qe.size.height)*2+1),qe.raycaster.setFromCamera(qe.pointer,qe.camera)}}),P?.(me)}}),J.current.render(On.jsx(U,{children:On.jsx(BP,{set:$,children:On.jsx(ft.Suspense,{fallback:On.jsx(OP,{set:j}),children:e??null})})}))}Ee()}}),ft.useEffect(()=>{const ce=z.current;if(ce)return()=>fS(ce)},[]);const pe=c?"none":"auto";return On.jsx("div",{ref:O,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:pe,...i},...R,children:On.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:On.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function WL(r){return On.jsx(Kb,{children:On.jsx(PL,{...r})})}function Dm(){return Dm=Object.assign?Object.assign.bind():function(r){for(var e=1;ee in r?LL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,NL=(r,e,t)=>(DL(r,e+"",t),t);class UL{constructor(){NL(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,l=i.length;oe in r?FL(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e,t)=>(OL(r,typeof e!="symbol"?e+"":e,t),t);const sh=new Ca,$x=new ks,BL=Math.cos(70*(Math.PI/180)),Jx=(r,e)=>(r%e+e)%e;let zL=class extends UL{constructor(e,t){super(),ct(this,"object"),ct(this,"domElement"),ct(this,"enabled",!0),ct(this,"target",new F),ct(this,"minDistance",0),ct(this,"maxDistance",1/0),ct(this,"minZoom",0),ct(this,"maxZoom",1/0),ct(this,"minPolarAngle",0),ct(this,"maxPolarAngle",Math.PI),ct(this,"minAzimuthAngle",-1/0),ct(this,"maxAzimuthAngle",1/0),ct(this,"enableDamping",!1),ct(this,"dampingFactor",.05),ct(this,"enableZoom",!0),ct(this,"zoomSpeed",1),ct(this,"enableRotate",!0),ct(this,"rotateSpeed",1),ct(this,"enablePan",!0),ct(this,"panSpeed",1),ct(this,"screenSpacePanning",!0),ct(this,"keyPanSpeed",7),ct(this,"zoomToCursor",!1),ct(this,"autoRotate",!1),ct(this,"autoRotateSpeed",2),ct(this,"reverseOrbit",!1),ct(this,"reverseHorizontalOrbit",!1),ct(this,"reverseVerticalOrbit",!1),ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ct(this,"mouseButtons",{LEFT:ua.ROTATE,MIDDLE:ua.DOLLY,RIGHT:ua.PAN}),ct(this,"touches",{ONE:ha.ROTATE,TWO:ha.DOLLY_PAN}),ct(this,"target0"),ct(this,"position0"),ct(this,"zoom0"),ct(this,"_domElementKeyEvents",null),ct(this,"getPolarAngle"),ct(this,"getAzimuthalAngle"),ct(this,"setPolarAngle"),ct(this,"setAzimuthalAngle"),ct(this,"getDistance"),ct(this,"getZoomScale"),ct(this,"listenToKeyEvents"),ct(this,"stopListenToKeyEvents"),ct(this,"saveState"),ct(this,"reset"),ct(this,"update"),ct(this,"connect"),ct(this,"dispose"),ct(this,"dollyIn"),ct(this,"dollyOut"),ct(this,"getScale"),ct(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=k=>{let te=Jx(k,2*Math.PI),Le=p.phi;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-V{let te=Jx(k,2*Math.PI),Le=p.theta;Le<0&&(Le+=2*Math.PI),te<0&&(te+=2*Math.PI);let V=Math.abs(te-Le);2*Math.PI-Vn.object.position.distanceTo(n.target),this.listenToKeyEvents=k=>{k.addEventListener("keydown",re),this._domElementKeyEvents=k},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=c.NONE},this.update=(()=>{const k=new F,te=new F(0,1,0),Le=new Bn().setFromUnitVectors(e.up,te),V=Le.clone().invert(),ve=new F,be=new Bn,Be=2*Math.PI;return function(){const oe=n.object.position;Le.setFromUnitVectors(e.up,te),V.copy(Le).invert(),k.copy(oe).sub(n.target),k.applyQuaternion(Le),p.setFromVector3(k),n.autoRotate&&h===c.NONE&&j(X()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let We=n.minAzimuthAngle,st=n.maxAzimuthAngle;isFinite(We)&&isFinite(st)&&(We<-Math.PI?We+=Be:We>Math.PI&&(We-=Be),st<-Math.PI?st+=Be:st>Math.PI&&(st-=Be),We<=st?p.theta=Math.max(We,Math.min(st,p.theta)):p.theta=p.theta>(We+st)/2?Math.max(We,p.theta):Math.min(st,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&I||n.object.isOrthographicCamera?p.radius=qe(p.radius):p.radius=qe(p.radius*m),k.setFromSpherical(p),k.applyQuaternion(V),oe.copy(n.target).add(k),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),v.set(0,0,0));let Et=!1;if(n.zoomToCursor&&I){let At=null;if(n.object instanceof dn&&n.object.isPerspectiveCamera){const An=k.length();At=qe(An*m);const Sn=An-At;n.object.position.addScaledVector(U,Sn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const An=new F(A.x,A.y,0);An.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Et=!0;const Sn=new F(A.x,A.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(An),n.object.updateMatrixWorld(),At=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(sh.origin.copy(n.object.position),sh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(sh.direction))f||8*(1-be.dot(n.object.quaternion))>f?(n.dispatchEvent(i),ve.copy(n.object.position),be.copy(n.object.quaternion),Et=!1,!0):!1}})(),this.connect=k=>{n.domElement=k,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Je),n.domElement.addEventListener("pointerdown",Me),n.domElement.addEventListener("pointercancel",C),n.domElement.addEventListener("wheel",he)},this.dispose=()=>{var k,te,Le,V,ve,be;n.domElement&&(n.domElement.style.touchAction="auto"),(k=n.domElement)==null||k.removeEventListener("contextmenu",Je),(te=n.domElement)==null||te.removeEventListener("pointerdown",Me),(Le=n.domElement)==null||Le.removeEventListener("pointercancel",C),(V=n.domElement)==null||V.removeEventListener("wheel",he),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",N),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",C),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",re)};const n=this,i={type:"change"},o={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const f=1e-6,p=new Sm,g=new Sm;let m=1;const v=new F,_=new ue,E=new ue,b=new ue,y=new ue,M=new ue,T=new ue,w=new ue,P=new ue,R=new ue,U=new F,A=new ue;let I=!1;const z=[],O={};function X(){return 2*Math.PI/60/60*n.autoRotateSpeed}function G(){return Math.pow(.95,n.zoomSpeed)}function j(k){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=k:g.theta-=k}function q(k){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=k:g.phi-=k}const $=(()=>{const k=new F;return function(Le,V){k.setFromMatrixColumn(V,0),k.multiplyScalar(-Le),v.add(k)}})(),J=(()=>{const k=new F;return function(Le,V){n.screenSpacePanning===!0?k.setFromMatrixColumn(V,1):(k.setFromMatrixColumn(V,0),k.crossVectors(n.object.up,k)),k.multiplyScalar(Le),v.add(k)}})(),pe=(()=>{const k=new F;return function(Le,V){const ve=n.domElement;if(ve&&n.object instanceof dn&&n.object.isPerspectiveCamera){const be=n.object.position;k.copy(be).sub(n.target);let Be=k.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),$(2*Le*Be/ve.clientHeight,n.object.matrix),J(2*V*Be/ve.clientHeight,n.object.matrix)}else ve&&n.object instanceof Ws&&n.object.isOrthographicCamera?($(Le*(n.object.right-n.object.left)/n.object.zoom/ve.clientWidth,n.object.matrix),J(V*(n.object.top-n.object.bottom)/n.object.zoom/ve.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(k){n.object instanceof dn&&n.object.isPerspectiveCamera||n.object instanceof Ws&&n.object.isOrthographicCamera?m=k:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ee(k){ce(m/k)}function me(k){ce(m*k)}function _e(k){if(!n.zoomToCursor||!n.domElement)return;I=!0;const te=n.domElement.getBoundingClientRect(),Le=k.clientX-te.left,V=k.clientY-te.top,ve=te.width,be=te.height;A.x=Le/ve*2-1,A.y=-(V/be)*2+1,U.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function qe(k){return Math.max(n.minDistance,Math.min(n.maxDistance,k))}function ot(k){_.set(k.clientX,k.clientY)}function Tt(k){_e(k),w.set(k.clientX,k.clientY)}function le(k){y.set(k.clientX,k.clientY)}function Ae(k){E.set(k.clientX,k.clientY),b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E),n.update()}function Ce(k){P.set(k.clientX,k.clientY),R.subVectors(P,w),R.y>0?Ee(G()):R.y<0&&me(G()),w.copy(P),n.update()}function $e(k){M.set(k.clientX,k.clientY),T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M),n.update()}function et(k){_e(k),k.deltaY<0?me(G()):k.deltaY>0&&Ee(G()),n.update()}function lt(k){let te=!1;switch(k.code){case n.keys.UP:pe(0,n.keyPanSpeed),te=!0;break;case n.keys.BOTTOM:pe(0,-n.keyPanSpeed),te=!0;break;case n.keys.LEFT:pe(n.keyPanSpeed,0),te=!0;break;case n.keys.RIGHT:pe(-n.keyPanSpeed,0),te=!0;break}te&&(k.preventDefault(),n.update())}function wt(){if(z.length==1)_.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);_.set(k,te)}}function at(){if(z.length==1)y.set(z[0].pageX,z[0].pageY);else{const k=.5*(z[0].pageX+z[1].pageX),te=.5*(z[0].pageY+z[1].pageY);y.set(k,te)}}function de(){const k=z[0].pageX-z[1].pageX,te=z[0].pageY-z[1].pageY,Le=Math.sqrt(k*k+te*te);w.set(0,Le)}function xe(){n.enableZoom&&de(),n.enablePan&&at()}function fe(){n.enableZoom&&de(),n.enableRotate&&wt()}function Pe(k){if(z.length==1)E.set(k.pageX,k.pageY);else{const Le=Ye(k),V=.5*(k.pageX+Le.x),ve=.5*(k.pageY+Le.y);E.set(V,ve)}b.subVectors(E,_).multiplyScalar(n.rotateSpeed);const te=n.domElement;te&&(j(2*Math.PI*b.x/te.clientHeight),q(2*Math.PI*b.y/te.clientHeight)),_.copy(E)}function B(k){if(z.length==1)M.set(k.pageX,k.pageY);else{const te=Ye(k),Le=.5*(k.pageX+te.x),V=.5*(k.pageY+te.y);M.set(Le,V)}T.subVectors(M,y).multiplyScalar(n.panSpeed),pe(T.x,T.y),y.copy(M)}function Qe(k){const te=Ye(k),Le=k.pageX-te.x,V=k.pageY-te.y,ve=Math.sqrt(Le*Le+V*V);P.set(0,ve),R.set(0,Math.pow(P.y/w.y,n.zoomSpeed)),Ee(R.y),w.copy(P)}function Oe(k){n.enableZoom&&Qe(k),n.enablePan&&B(k)}function nt(k){n.enableZoom&&Qe(k),n.enableRotate&&Pe(k)}function Me(k){var te,Le;n.enabled!==!1&&(z.length===0&&((te=n.domElement)==null||te.ownerDocument.addEventListener("pointermove",N),(Le=n.domElement)==null||Le.ownerDocument.addEventListener("pointerup",C)),rt(k),k.pointerType==="touch"?He(k):W(k))}function N(k){n.enabled!==!1&&(k.pointerType==="touch"?Te(k):se(k))}function C(k){var te,Le,V;ye(k),z.length===0&&((te=n.domElement)==null||te.releasePointerCapture(k.pointerId),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",N),(V=n.domElement)==null||V.ownerDocument.removeEventListener("pointerup",C)),n.dispatchEvent(l),h=c.NONE}function W(k){let te;switch(k.button){case 0:te=n.mouseButtons.LEFT;break;case 1:te=n.mouseButtons.MIDDLE;break;case 2:te=n.mouseButtons.RIGHT;break;default:te=-1}switch(te){case ua.DOLLY:if(n.enableZoom===!1)return;Tt(k),h=c.DOLLY;break;case ua.ROTATE:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enablePan===!1)return;le(k),h=c.PAN}else{if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}break;case ua.PAN:if(k.ctrlKey||k.metaKey||k.shiftKey){if(n.enableRotate===!1)return;ot(k),h=c.ROTATE}else{if(n.enablePan===!1)return;le(k),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function se(k){if(n.enabled!==!1)switch(h){case c.ROTATE:if(n.enableRotate===!1)return;Ae(k);break;case c.DOLLY:if(n.enableZoom===!1)return;Ce(k);break;case c.PAN:if(n.enablePan===!1)return;$e(k);break}}function he(k){n.enabled===!1||n.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(k.preventDefault(),n.dispatchEvent(o),et(k),n.dispatchEvent(l))}function re(k){n.enabled===!1||n.enablePan===!1||lt(k)}function He(k){switch(we(k),z.length){case 1:switch(n.touches.ONE){case ha.ROTATE:if(n.enableRotate===!1)return;wt(),h=c.TOUCH_ROTATE;break;case ha.PAN:if(n.enablePan===!1)return;at(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(n.touches.TWO){case ha.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xe(),h=c.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;fe(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&n.dispatchEvent(o)}function Te(k){switch(we(k),h){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pe(k),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;B(k),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Oe(k),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(k),n.update();break;default:h=c.NONE}}function Je(k){n.enabled!==!1&&k.preventDefault()}function rt(k){z.push(k)}function ye(k){delete O[k.pointerId];for(let te=0;te{me(k),n.update()},this.dollyOut=(k=G())=>{Ee(k),n.update()},this.getScale=()=>m,this.setScale=k=>{ce(k),n.update()},this.getZoomScale=()=>G(),t!==void 0&&this.connect(t),this.update()}};const qL=ft.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:o=!1,onChange:l,onStart:c,onEnd:h,...f},p)=>{const g=vr(R=>R.invalidate),m=vr(R=>R.camera),v=vr(R=>R.gl),_=vr(R=>R.events),E=vr(R=>R.setEvents),b=vr(R=>R.set),y=vr(R=>R.get),M=vr(R=>R.performance),T=e||m,w=n||_.connected||v.domElement,P=ft.useMemo(()=>new zL(T),[T]);return ZP(()=>{P.enabled&&P.update()},-1),ft.useEffect(()=>(o&&P.connect(o===!0?w:o),P.connect(w),()=>{P.dispose()}),[o,w,t,P,g]),ft.useEffect(()=>{const R=I=>{g(),t&&M.regress(),l&&l(I)},U=I=>{c&&c(I)},A=I=>{h&&h(I)};return P.addEventListener("change",R),P.addEventListener("start",U),P.addEventListener("end",A),()=>{P.removeEventListener("start",U),P.removeEventListener("end",A),P.removeEventListener("change",R)}},[l,c,h,P,g,E]),ft.useEffect(()=>{if(r){const R=y().controls;return b({controls:P}),()=>b({controls:R})}},[r,P]),ft.createElement("primitive",Dm({ref:p,object:P,enableDamping:i},f))});export{ub as $,Cb as A,eg as B,ss as C,ds as D,Bl as E,qs as F,Po as G,_w as H,Lf as I,_s as J,ii as K,mi as L,bn as M,oc as N,Ft as O,Ut as P,Bn as Q,of as R,Bi as S,xw as T,Jm as U,Zt as V,nT as W,Qt as X,jn as Y,df as Z,Sg as _,F as a,vr as a0,oS as a1,Xw as a2,ZP as a3,Zn as a4,zn as a5,Dm as a6,$m as a7,Xo as a8,Ri as a9,Ra as aA,Jy as aB,ug as aC,PT as aD,ua as aE,cf as aa,Yb as ab,is as ac,Er as ad,Cr as ae,uf as af,Hm as ag,Vm as ah,Oi as ai,ti as aj,gg as ak,F1 as al,Yn as am,gs as an,vs as ao,vw as ap,hL as aq,Tg as ar,GL as as,xr as at,hg as au,pn as av,WL as aw,si as ax,qL as ay,bs as az,ym as b,Zl as c,pi as d,ln as e,fb as f,mb as g,Xe as h,mt as i,Ws as j,dn as k,wb as l,HE as m,Tb as n,Ab as o,Wy as p,ri as q,wr as r,Ef as s,vt as t,Ze as u,xt as v,Ii as w,cc as x,lc as y,xc as z}; diff --git a/best_annotator/static/assets/SkinEditor-B3e0be2n.js b/best_annotator/static/assets/SkinEditor-B3e0be2n.js new file mode 100644 index 0000000000000000000000000000000000000000..e8dbbfa56c5957fe39d1a6586f920297421cb7e3 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-B3e0be2n.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-Cwjw6kcd.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-D8dMCyiM.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-BsOaSug0.css b/best_annotator/static/assets/SkinEditor-BsOaSug0.css new file mode 100644 index 0000000000000000000000000000000000000000..3689f05ec1058b33ebcec84a0cd50183d34cd555 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-BsOaSug0.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-xl:36rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-bold:700;--tracking-widest:.1em;--leading-relaxed:1.625;--blur-md:12px;--blur-lg:16px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base{.editor-surface :where(button){background-color:#0000;border:0 solid;padding:0}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.visible\!{visibility:visible!important}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.static\!{position:static!important}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-4{top:calc(var(--spacing) * 4)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-1\/2{left:50%}.left-16{left:calc(var(--spacing) * 16)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.mx-1{margin-inline:calc(var(--spacing) * 1)}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.hidden\!{display:none!important}.inline{display:inline}.inline-block{display:inline-block}.table{display:table}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-12{height:calc(var(--spacing) * 12)}.h-full{height:100%}.h-px{height:1px}.max-h-\[72px\]{max-height:72px}.min-h-0{min-height:calc(var(--spacing) * 0)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-\[92\%\]{width:92%}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\[300px\]{max-width:300px}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[240px\]{min-width:240px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-crosshair{cursor:crosshair}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.appearance-none{appearance:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-none{border-radius:0}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\[\#4ea632\]{border-color:#4ea632}.border-\[\#4ea632\]\/80{border-color:#4ea632cc}.border-black{border-color:var(--color-black)}.border-black\/50{border-color:#00000080}@supports (color:color-mix(in lab,red,red)){.border-black\/50{border-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.border-white{border-color:var(--color-white)}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-\[\#1a1a1a\]{background-color:#1a1a1a}.bg-\[\#3c8527\]{background-color:#3c8527}.bg-\[\#4ea632\]{background-color:#4ea632}.bg-\[\#4ea632\]\/10{background-color:#4ea6321a}.bg-\[\#555\]{background-color:#555}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black) 90%,transparent)}}.bg-transparent{background-color:#0000}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-3{padding-block:calc(var(--spacing) * 3)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.text-center{text-align:center}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-\[\#4ea632\]{color:#4ea632}.text-white{color:var(--color-white)}.text-white\/30{color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.text-white\/30{color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.uppercase{text-transform:uppercase}.accent-\[\#4ea632\]{accent-color:#4ea632}.opacity-0{opacity:0}.opacity-30{opacity:.3}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-white\/60{--tw-ring-color:#fff9}@supports (color:color-mix(in lab,red,red)){.ring-white\/60{--tw-ring-color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:bg-\[\#4ea632\]:hover{background-color:#4ea632}.hover\:bg-\[\#666\]:hover{background-color:#666}.hover\:bg-black\/80:hover{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/80:hover{background-color:color-mix(in oklab,var(--color-black) 80%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.hover\:bg-zinc-700:hover{background-color:var(--color-zinc-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:text-white\/60:hover{color:#fff9}@supports (color:color-mix(in lab,red,red)){.hover\:text-white\/60:hover{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}}.active\:translate-y-px:active{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}@media not all and (min-width:64rem){.max-lg\:right-4{right:calc(var(--spacing) * 4)}.max-lg\:bottom-20{bottom:calc(var(--spacing) * 20)}.max-lg\:left-4{left:calc(var(--spacing) * 4)}}@media(min-width:40rem){.sm\:h-6{height:calc(var(--spacing) * 6)}.sm\:w-6{width:calc(var(--spacing) * 6)}.sm\:w-auto{width:auto}.sm\:max-w-xl{max-width:var(--container-xl)}.sm\:flex-row{flex-direction:row}}@media(min-width:64rem){.lg\:top-1\/2{top:50%}.lg\:right-4{right:calc(var(--spacing) * 4)}.lg\:bottom-4{bottom:calc(var(--spacing) * 4)}.lg\:left-4{left:calc(var(--spacing) * 4)}.lg\:-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1} diff --git a/best_annotator/static/assets/SkinEditor-CCEH8j8M.js b/best_annotator/static/assets/SkinEditor-CCEH8j8M.js new file mode 100644 index 0000000000000000000000000000000000000000..ea82d88ce61c067bb14d11d4f3e64b25cbb02ebd --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-CCEH8j8M.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-BwpaCc7o.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-C_CiZNu6.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-CHK_whzc.js b/best_annotator/static/assets/SkinEditor-CHK_whzc.js new file mode 100644 index 0000000000000000000000000000000000000000..5f91205b7cf787dec003936012e0c6a4b8a97202 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-CHK_whzc.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-FsJherd9.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-DWROePHL.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-D4aKozkb.js b/best_annotator/static/assets/SkinEditor-D4aKozkb.js new file mode 100644 index 0000000000000000000000000000000000000000..bcea3aedee41518539f70b1c52c00af3a6c76ee9 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-D4aKozkb.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-FHNXxhzy.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-B8kTSyNG.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-DLV3L4Lz.js b/best_annotator/static/assets/SkinEditor-DLV3L4Lz.js new file mode 100644 index 0000000000000000000000000000000000000000..05f74ef850e5da93d2c0e856f539168e92a02d86 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-DLV3L4Lz.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-1xYycQFu.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-DQYijb2B.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-DME5JXP2.js b/best_annotator/static/assets/SkinEditor-DME5JXP2.js new file mode 100644 index 0000000000000000000000000000000000000000..e7d7992d2da0bd626a5f70efcef4e44f71dd5ba5 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-DME5JXP2.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-CzS-rxOV.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-BNs7WpFn.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-DdoQReIT.js b/best_annotator/static/assets/SkinEditor-DdoQReIT.js new file mode 100644 index 0000000000000000000000000000000000000000..ac80f293993d87d440d24d1730d6ad527cd129df --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-DdoQReIT.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-Cch6ovWF.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-fNwVPk9t.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-DeZxzTfI.js b/best_annotator/static/assets/SkinEditor-DeZxzTfI.js new file mode 100644 index 0000000000000000000000000000000000000000..1f00dccb54644c6900c957ec2a057a9a38a0f5b5 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-DeZxzTfI.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-DqXMzOA0.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-CHt0YeD1.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-Lxi3fNFj.js b/best_annotator/static/assets/SkinEditor-Lxi3fNFj.js new file mode 100644 index 0000000000000000000000000000000000000000..83fb581f02859848afb96e527b3279801177ff59 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-Lxi3fNFj.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-F-L6ur0r.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-DCehNZC0.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-TQinzOLu.js b/best_annotator/static/assets/SkinEditor-TQinzOLu.js new file mode 100644 index 0000000000000000000000000000000000000000..442cea905a2e3fd8c512c3676a9ba711c884a882 --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-TQinzOLu.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-D4HloxTJ.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-JGGzURQK.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/SkinEditor-VMsAFhH-.js b/best_annotator/static/assets/SkinEditor-VMsAFhH-.js new file mode 100644 index 0000000000000000000000000000000000000000..0ad108d62db369c44060415660c537c90cbe6aef --- /dev/null +++ b/best_annotator/static/assets/SkinEditor-VMsAFhH-.js @@ -0,0 +1,208 @@ +import{r as I,j as w}from"./index-CK5rLR8o.js";import{R as $n,M as Ft,I as Go,S as qt,D as Er,V as Tr,a as fe,C as Wo,L as Xn,b as $o,F as fr,T as kr,c as zn,d as ct,e as ht,f as Nr,g as Zn,h as at,E as Yn,i as Ce,G as qr,B as Sn,P as _r,O as dr,j as Kn,k as Xo,l as In,m as Be,n as Zo,o as Yo,p as Ko,q as qn,r as qo,s as Qo,A as Jo,t as cr,u as Pt,U as ea,v as ta,w as hr,x as ra,Q as $e,y as na,z as oa,N as aa,H as Qn,J as Xe,K as gt,W as Zt,X as ut,Y as Qt,Z as ia,_ as sa,$ as la,a0 as Ne,a1 as ft,a2 as ca,a3 as jt,a4 as Jn,a5 as ha,a6 as Ct,a7 as eo,a8 as sn,a9 as Jt,aa as Ar,ab as ua,ac as to,ad as Qr,ae as Rt,af as fa,ag as da,ah as ma,ai as pa,aj as Hr,ak as va,al as Cn,am as Yt,an as ga,ao as ya,ap as wa,aq as ro,ar as xa,as as ba,at as En,au as Ma,av as Je,aw as za,ax as Sa,ay as Ia,az as no,aA as Dt,aB as _n,aC as oo,aD as Vr}from"./OrbitControls-DmqzLDA6.js";function Ca(a,e){const t=a.icons,n=a.aliases||Object.create(null),r=Object.create(null);function o(i){if(t[i])return r[i]=[];if(!(i in r)){r[i]=null;const l=n[i]&&n[i].parent,s=l&&o(l);s&&(r[i]=[l].concat(s))}return r[i]}return Object.keys(t).concat(Object.keys(n)).forEach(o),r}const ao=Object.freeze({left:0,top:0,width:16,height:16}),Lr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ln=Object.freeze({...ao,...Lr}),Jr=Object.freeze({...ln,body:"",hidden:!1});function Ea(a,e){const t={};!a.hFlip!=!e.hFlip&&(t.hFlip=!0),!a.vFlip!=!e.vFlip&&(t.vFlip=!0);const n=((a.rotate||0)+(e.rotate||0))%4;return n&&(t.rotate=n),t}function An(a,e){const t=Ea(a,e);for(const n in Jr)n in Lr?n in a&&!(n in t)&&(t[n]=Lr[n]):n in e?t[n]=e[n]:n in a&&(t[n]=a[n]);return t}function _a(a,e,t){const n=a.icons,r=a.aliases||Object.create(null);let o={};function i(l){o=An(n[l]||r[l],o)}return i(e),t.forEach(i),An(a,o)}function io(a,e){const t=[];if(typeof a!="object"||typeof a.icons!="object")return t;a.not_found instanceof Array&&a.not_found.forEach(r=>{e(r,null),t.push(r)});const n=Ca(a);for(const r in n){const o=n[r];o&&(e(r,_a(a,r,o)),t.push(r))}return t}const Aa={provider:"",aliases:{},not_found:{},...ao};function Gr(a,e){for(const t in e)if(t in a&&typeof a[t]!=typeof e[t])return!1;return!0}function so(a){if(typeof a!="object"||a===null)return null;const e=a;if(typeof e.prefix!="string"||!a.icons||typeof a.icons!="object"||!Gr(a,Aa))return null;const t=e.icons;for(const r in t){const o=t[r];if(!r||typeof o.body!="string"||!Gr(o,Jr))return null}const n=e.aliases||Object.create(null);for(const r in n){const o=n[r],i=o.parent;if(!r||typeof i!="string"||!t[i]&&!n[i]||!Gr(o,Jr))return null}return e}const Hn=Object.create(null);function Ha(a,e){return{provider:a,prefix:e,icons:Object.create(null),missing:new Set}}function er(a,e){const t=Hn[a]||(Hn[a]=Object.create(null));return t[e]||(t[e]=Ha(a,e))}function lo(a,e){return so(e)?io(e,(t,n)=>{n?a.icons[t]=n:a.missing.add(t)}):[]}function La(a,e,t){try{if(typeof t.body=="string")return a.icons[e]={...t},!0}catch{}return!1}const co=/^[a-z0-9]+(-[a-z0-9]+)*$/,Pr=(a,e,t,n="")=>{const r=a.split(":");if(a.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;n=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),s=r.pop(),h={provider:r.length>0?r[0]:n,prefix:s,name:l};return e&&!Ir(h)?null:h}const o=r[0],i=o.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return e&&!Ir(l)?null:l}if(t&&n===""){const l={provider:n,prefix:"",name:o};return e&&!Ir(l,t)?null:l}return null},Ir=(a,e)=>a?!!((e&&a.prefix===""||a.prefix)&&a.name):!1;let vr=!1;function ho(a){return typeof a=="boolean"&&(vr=a),vr}function Ln(a){const e=typeof a=="string"?Pr(a,!0,vr):a;if(e){const t=er(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function Ta(a,e){const t=Pr(a,!0,vr);if(!t)return!1;const n=er(t.provider,t.prefix);return e?La(n,t.name,e):(n.missing.add(t.name),!0)}function uo(a,e){if(typeof a!="object")return!1;if(typeof e!="string"&&(e=a.provider||""),vr&&!e&&!a.prefix){let r=!1;return so(a)&&(a.prefix="",io(a,(o,i)=>{Ta(o,i)&&(r=!0)})),r}const t=a.prefix;if(!Ir({prefix:t,name:"a"}))return!1;const n=er(e,t);return!!lo(n,a)}const fo=Object.freeze({width:null,height:null}),mo=Object.freeze({...fo,...Lr}),ka=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Pa=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Tn(a,e,t){if(e===1)return a;if(t=t||100,typeof a=="number")return Math.ceil(a*e*t)/t;if(typeof a!="string")return a;const n=a.split(ka);if(n===null||!n.length)return a;const r=[];let o=n.shift(),i=Pa.test(o);for(;;){if(i){const l=parseFloat(o);isNaN(l)?r.push(o):r.push(Math.ceil(l*e*t)/t)}else r.push(o);if(o=n.shift(),o===void 0)return r.join("");i=!i}}function Da(a,e="defs"){let t="";const n=a.indexOf("<"+e);for(;n>=0;){const r=a.indexOf(">",n),o=a.indexOf("",o);if(i===-1)break;t+=a.slice(r+1,o).trim(),a=a.slice(0,n).trim()+a.slice(i+1)}return{defs:t,content:a}}function Ra(a,e){return a?""+a+""+e:e}function Fa(a,e,t){const n=Da(a);return Ra(n.defs,e+n.content+t)}const ja=a=>a==="unset"||a==="undefined"||a==="none";function Oa(a,e){const t={...ln,...a},n={...mo,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(y=>{const M=[],S=y.hFlip,g=y.vFlip;let H=y.rotate;S?g?H+=2:(M.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),M.push("scale(-1 1)"),r.top=r.left=0):g&&(M.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),M.push("scale(1 -1)"),r.top=r.left=0);let E;switch(H<0&&(H-=Math.floor(H/4)*4),H=H%4,H){case 1:E=r.height/2+r.top,M.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:M.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:E=r.width/2+r.left,M.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}H%2===1&&(r.left!==r.top&&(E=r.left,r.left=r.top,r.top=E),r.width!==r.height&&(E=r.width,r.width=r.height,r.height=E)),M.length&&(o=Fa(o,'',""))});const i=n.width,l=n.height,s=r.width,h=r.height;let m,u;i===null?(u=l===null?"1em":l==="auto"?h:l,m=Tn(u,s/h)):(m=i==="auto"?s:i,u=l===null?Tn(m,h/s):l==="auto"?h:l);const d={},z=(y,M)=>{ja(M)||(d[y]=M.toString())};z("width",m),z("height",u);const b=[r.left,r.top,s,h];return d.viewBox=b.join(" "),{attributes:d,viewBox:b,body:o}}const Ua=/\sid="(\S+)"/g,Ba="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Na=0;function Va(a,e=Ba){const t=[];let n;for(;n=Ua.exec(a);)t.push(n[1]);if(!t.length)return a;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(o=>{const i=typeof e=="function"?e(o):e+(Na++).toString(),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),a=a.replace(new RegExp(r,"g"),""),a}const en=Object.create(null);function Ga(a,e){en[a]=e}function tn(a){return en[a]||en[""]}function cn(a){let e;if(typeof a.resources=="string")e=[a.resources];else if(e=a.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:a.path||"/",maxURL:a.maxURL||500,rotate:a.rotate||750,timeout:a.timeout||5e3,random:a.random===!0,index:a.index||0,dataAfterTimeout:a.dataAfterTimeout!==!1}}const hn=Object.create(null),or=["https://api.simplesvg.com","https://api.unisvg.com"],Cr=[];for(;or.length>0;)or.length===1||Math.random()>.5?Cr.push(or.shift()):Cr.push(or.pop());hn[""]=cn({resources:["https://api.iconify.design"].concat(Cr)});function Wa(a,e){const t=cn(e);return t===null?!1:(hn[a]=t,!0)}function un(a){return hn[a]}const $a=()=>{let a;try{if(a=fetch,typeof a=="function")return a}catch{}};let kn=$a();function Xa(a,e){const t=un(a);if(!t)return 0;let n;if(!t.maxURL)n=0;else{let r=0;t.resources.forEach(i=>{r=Math.max(r,i.length)});const o=e+".json?icons=";n=t.maxURL-r-t.path.length-o.length}return n}function Za(a){return a===404}const Ya=(a,e,t)=>{const n=[],r=Xa(a,e),o="icons";let i={type:o,provider:a,prefix:e,icons:[]},l=0;return t.forEach((s,h)=>{l+=s.length+1,l>=r&&h>0&&(n.push(i),i={type:o,provider:a,prefix:e,icons:[]},l=s.length),i.icons.push(s)}),n.push(i),n};function Ka(a){if(typeof a=="string"){const e=un(a);if(e)return e.path}return"/"}const qa=(a,e,t)=>{if(!kn){t("abort",424);return}let n=Ka(e.provider);switch(e.type){case"icons":{const o=e.prefix,l=e.icons.join(","),s=new URLSearchParams({icons:l});n+=o+".json?"+s.toString();break}case"custom":{const o=e.uri;n+=o.slice(0,1)==="/"?o.slice(1):o;break}default:t("abort",400);return}let r=503;kn(a+n).then(o=>{const i=o.status;if(i!==200){setTimeout(()=>{t(Za(i)?"abort":"next",i)});return}return r=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?t("abort",o):t("next",r)});return}setTimeout(()=>{t("success",o)})}).catch(()=>{t("next",r)})},Qa={prepare:Ya,send:qa};function po(a,e){a.forEach(t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter(r=>r.id!==e))})}function Ja(a){a.pendingCallbacksFlag||(a.pendingCallbacksFlag=!0,setTimeout(()=>{a.pendingCallbacksFlag=!1;const e=a.loaderCallbacks?a.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const n=a.provider,r=a.prefix;e.forEach(o=>{const i=o.icons,l=i.pending.length;i.pending=i.pending.filter(s=>{if(s.prefix!==r)return!0;const h=s.name;if(a.icons[h])i.loaded.push({provider:n,prefix:r,name:h});else if(a.missing.has(h))i.missing.push({provider:n,prefix:r,name:h});else return t=!0,!0;return!1}),i.pending.length!==l&&(t||po([a],o.id),o.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),o.abort))})}))}let ei=0;function ti(a,e,t){const n=ei++,r=po.bind(null,t,n);if(!e.pending.length)return r;const o={id:n,icons:e,callback:a,abort:r};return t.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(o)}),r}function ri(a){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);a.sort((r,o)=>r.provider!==o.provider?r.provider.localeCompare(o.provider):r.prefix!==o.prefix?r.prefix.localeCompare(o.prefix):r.name.localeCompare(o.name));let n={provider:"",prefix:"",name:""};return a.forEach(r=>{if(n.name===r.name&&n.prefix===r.prefix&&n.provider===r.provider)return;n=r;const o=r.provider,i=r.prefix,l=r.name,s=t[o]||(t[o]=Object.create(null)),h=s[i]||(s[i]=er(o,i));let m;l in h.icons?m=e.loaded:i===""||h.missing.has(l)?m=e.missing:m=e.pending;const u={provider:o,prefix:i,name:l};m.push(u)}),e}function ni(a,e=!0,t=!1){const n=[];return a.forEach(r=>{const o=typeof r=="string"?Pr(r,e,t):r;o&&n.push(o)}),n}const oi={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ai(a,e,t,n){const r=a.resources.length,o=a.random?Math.floor(Math.random()*r):a.index;let i;if(a.random){let v=a.resources.slice(0);for(i=[];v.length>1;){const A=Math.floor(Math.random()*v.length);i.push(v[A]),v=v.slice(0,A).concat(v.slice(A+1))}i=i.concat(v)}else i=a.resources.slice(o).concat(a.resources.slice(0,o));const l=Date.now();let s="pending",h=0,m,u=null,d=[],z=[];typeof n=="function"&&z.push(n);function b(){u&&(clearTimeout(u),u=null)}function y(){s==="pending"&&(s="aborted"),b(),d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function M(v,A){A&&(z=[]),typeof v=="function"&&z.push(v)}function S(){return{startTime:l,payload:e,status:s,queriesSent:h,queriesPending:d.length,subscribe:M,abort:y}}function g(){s="failed",z.forEach(v=>{v(void 0,m)})}function H(){d.forEach(v=>{v.status==="pending"&&(v.status="aborted")}),d=[]}function E(v,A,_){const D=A!=="success";switch(d=d.filter(j=>j!==v),s){case"pending":break;case"failed":if(D||!a.dataAfterTimeout)return;break;default:return}if(A==="abort"){m=_,g();return}if(D){m=_,d.length||(i.length?C():g());return}if(b(),H(),!a.random){const j=a.resources.indexOf(v.resource);j!==-1&&j!==a.index&&(a.index=j)}s="completed",z.forEach(j=>{j(_)})}function C(){if(s!=="pending")return;b();const v=i.shift();if(v===void 0){if(d.length){u=setTimeout(()=>{b(),s==="pending"&&(H(),g())},a.timeout);return}g();return}const A={status:"pending",resource:v,callback:(_,D)=>{E(A,_,D)}};d.push(A),h++,u=setTimeout(C,a.rotate),t(v,e,A.callback)}return setTimeout(C),S}function vo(a){const e={...oi,...a};let t=[];function n(){t=t.filter(l=>l().status==="pending")}function r(l,s,h){const m=ai(e,l,s,(u,d)=>{n(),h&&h(u,d)});return t.push(m),m}function o(l){return t.find(s=>l(s))||null}return{query:r,find:o,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:n}}function Pn(){}const Wr=Object.create(null);function ii(a){if(!Wr[a]){const e=un(a);if(!e)return;const t=vo(e),n={config:e,redundancy:t};Wr[a]=n}return Wr[a]}function si(a,e,t){let n,r;if(typeof a=="string"){const o=tn(a);if(!o)return t(void 0,424),Pn;r=o.send;const i=ii(a);i&&(n=i.redundancy)}else{const o=cn(a);if(o){n=vo(o);const i=a.resources?a.resources[0]:"",l=tn(i);l&&(r=l.send)}}return!n||!r?(t(void 0,424),Pn):n.query(e,r,t)().abort}function Dn(){}function li(a){a.iconsLoaderFlag||(a.iconsLoaderFlag=!0,setTimeout(()=>{a.iconsLoaderFlag=!1,Ja(a)}))}function ci(a){const e=[],t=[];return a.forEach(n=>{(n.match(co)?e:t).push(n)}),{valid:e,invalid:t}}function ar(a,e,t){function n(){const r=a.pendingIcons;e.forEach(o=>{r&&r.delete(o),a.icons[o]||a.missing.add(o)})}if(t&&typeof t=="object")try{if(!lo(a,t).length){n();return}}catch(r){console.error(r)}n(),li(a)}function Rn(a,e){a instanceof Promise?a.then(t=>{e(t)}).catch(()=>{e(null)}):e(a)}function hi(a,e){a.iconsToLoad?a.iconsToLoad=a.iconsToLoad.concat(e).sort():a.iconsToLoad=e,a.iconsQueueFlag||(a.iconsQueueFlag=!0,setTimeout(()=>{a.iconsQueueFlag=!1;const{provider:t,prefix:n}=a,r=a.iconsToLoad;if(delete a.iconsToLoad,!r||!r.length)return;const o=a.loadIcon;if(a.loadIcons&&(r.length>1||!o)){Rn(a.loadIcons(r,n,t),m=>{ar(a,r,m)});return}if(o){r.forEach(m=>{const u=o(m,n,t);Rn(u,d=>{const z=d?{prefix:n,icons:{[m]:d}}:null;ar(a,[m],z)})});return}const{valid:i,invalid:l}=ci(r);if(l.length&&ar(a,l,null),!i.length)return;const s=n.match(co)?tn(t):null;if(!s){ar(a,i,null);return}s.prepare(t,n,i).forEach(m=>{si(t,m,u=>{ar(a,m.icons,u)})})}))}const ui=(a,e)=>{const t=ni(a,!0,ho()),n=ri(t);if(!n.pending.length){let s=!0;return e&&setTimeout(()=>{s&&e(n.loaded,n.missing,n.pending,Dn)}),()=>{s=!1}}const r=Object.create(null),o=[];let i,l;return n.pending.forEach(s=>{const{provider:h,prefix:m}=s;if(m===l&&h===i)return;i=h,l=m,o.push(er(h,m));const u=r[h]||(r[h]=Object.create(null));u[m]||(u[m]=[])}),n.pending.forEach(s=>{const{provider:h,prefix:m,name:u}=s,d=er(h,m),z=d.pendingIcons||(d.pendingIcons=new Set);z.has(u)||(z.add(u),r[h][m].push(u))}),o.forEach(s=>{const h=r[s.provider][s.prefix];h.length&&hi(s,h)}),e?ti(e,n,o):Dn};function fi(a,e){const t={...a};for(const n in e){const r=e[n],o=typeof r;n in fo?(r===null||r&&(o==="string"||o==="number"))&&(t[n]=r):o===typeof t[n]&&(t[n]=n==="rotate"?r%4:r)}return t}const di=/[\s,]+/;function mi(a,e){e.split(di).forEach(t=>{switch(t.trim()){case"horizontal":a.hFlip=!0;break;case"vertical":a.vFlip=!0;break}})}function pi(a,e=0){const t=a.replace(/^-?[0-9.]*/,"");function n(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(a);return isNaN(r)?0:n(r)}else if(t!==a){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let o=parseFloat(a.slice(0,a.length-t.length));return isNaN(o)?0:(o=o/r,o%1===0?n(o):0)}}return e}function vi(a,e){let t=a.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)t+=" "+n+'="'+e[n]+'"';return'"+a+""}function gi(a){return a.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function yi(a){return"data:image/svg+xml,"+gi(a)}function wi(a){return'url("'+yi(a)+'")'}let mr;function xi(){try{mr=window.trustedTypes.createPolicy("iconify",{createHTML:a=>a})}catch{mr=null}}function bi(a){return mr===void 0&&xi(),mr?mr.createHTML(a):a}const go={...mo,inline:!1},Mi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},zi={display:"inline-block"},rn={backgroundColor:"currentColor"},yo={backgroundColor:"transparent"},Fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:rn,mask:rn,background:yo};for(const a in jn){const e=jn[a];for(const t in Fn)e[a+t]=Fn[t]}const Si={...go,inline:!0};function On(a){return a+(a.match(/^[-0-9.]+$/)?"px":"")}const Ii=(a,e,t)=>{const n=e.inline?Si:go,r=fi(n,e),o=e.mode||"svg",i={},l=e.style||{},s={...o==="svg"?Mi:{}};if(t){const M=Pr(t,!1,!0);if(M){const S=["iconify"],g=["provider","prefix"];for(const H of g)M[H]&&S.push("iconify--"+M[H]);s.className=S.join(" ")}}for(let M in e){const S=e[M];if(S!==void 0)switch(M){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":s.ref=S;break;case"className":s[M]=(s[M]?s[M]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":r[M]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&mi(r,S);break;case"color":i.color=S;break;case"rotate":typeof S=="string"?r[M]=pi(S):typeof S=="number"&&(r[M]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete s["aria-hidden"];break;default:n[M]===void 0&&(s[M]=S)}}const h=Oa(a,r),m=h.attributes;if(r.inline&&(i.verticalAlign="-0.125em"),o==="svg"){s.style={...i,...l},Object.assign(s,m);let M=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),s.dangerouslySetInnerHTML={__html:bi(Va(h.body,S?()=>S+"ID"+M++:"iconifyReact"))},I.createElement("svg",s)}const{body:u,width:d,height:z}=a,b=o==="mask"||(o==="bg"?!1:u.indexOf("currentColor")!==-1),y=vi(u,{...m,width:d+"",height:z+""});return s.style={...i,"--svg":wi(y),width:On(m.width),height:On(m.height),...zi,...b?rn:yo,...l},I.createElement("span",s)};ho(!0);Ga("",Qa);if(typeof document<"u"&&typeof window<"u"){const a=window;if(a.IconifyPreload!==void 0){const e=a.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!uo(n))&&console.error(t)}catch{console.error(t)}})}if(a.IconifyProviders!==void 0){const e=a.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const n="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;Wa(t,r)||console.error(n)}catch{console.error(n)}}}}function wo(a){const[e,t]=I.useState(!!a.ssr),[n,r]=I.useState({});function o(z){if(z){const b=a.icon;if(typeof b=="object")return{name:"",data:b};const y=Ln(b);if(y)return{name:b,data:y}}return{name:""}}const[i,l]=I.useState(o(!!a.ssr));function s(){const z=n.callback;z&&(z(),r({}))}function h(z){if(JSON.stringify(i)!==JSON.stringify(z))return s(),l(z),!0}function m(){var z;const b=a.icon;if(typeof b=="object"){h({name:"",data:b});return}const y=Ln(b);if(h({name:b,data:y}))if(y===void 0){const M=ui([b],m);r({callback:M})}else y&&((z=a.onLoad)===null||z===void 0||z.call(a,b))}I.useEffect(()=>(t(!0),s),[]),I.useEffect(()=>{e&&m()},[a.icon,e]);const{name:u,data:d}=i;return d?Ii({...ln,...d},a,u):a.children?a.children:a.fallback?a.fallback:I.createElement("span",{})}const qe=I.forwardRef((a,e)=>wo({...a,_ref:e}));I.forwardRef((a,e)=>wo({inline:!0,...a,_ref:e}));const Ci={prefix:"pixelarticons",icons:{"arrow-down":{body:''},"arrow-left":{body:''},"arrow-up":{body:''},binary:{body:''},"book-open":{body:''},bookmark:{body:''},box:{body:''},"brackets-angle":{body:''},briefcase:{body:''},buildings:{body:'',hidden:!0},bullseye:{body:'',hidden:!0},calendar:{body:''},cart:{body:'',hidden:!0},"chart-add":{body:'',hidden:!0},check:{body:''},"check-double":{body:''},"chevron-down":{body:''},"chevron-left":{body:''},"chevron-right":{body:''},clock:{body:''},close:{body:'',hidden:!0},"close-box":{body:'',hidden:!0},"cloud-upload":{body:'',hidden:!0},dashboard:{body:'',hidden:!0},"device-laptop":{body:'',hidden:!0},"device-phone":{body:'',hidden:!0},"device-tv":{body:'',hidden:!0},dollar:{body:'',hidden:!0},download:{body:''},earth:{body:''},edit:{body:'',hidden:!0},eraser:{body:''},eye:{body:''},flag:{body:''},folder:{body:''},"folder-minus":{body:'',hidden:!0},"folder-x":{body:'',hidden:!0},forward:{body:''},"git-merge":{body:''},globe:{body:''},group:{body:'',hidden:!0},heart:{body:''},human:{body:''},"human-handsup":{body:'',hidden:!0},"human-run":{body:'',hidden:!0},image:{body:''},"image-gallery":{body:'',hidden:!0},"image-new":{body:''},"image-plus":{body:'',hidden:!0},"info-box":{body:''},list:{body:'',hidden:!0},"list-box":{body:''},loader:{body:''},lock:{body:''},logout:{body:''},mail:{body:''},menu:{body:''},notes:{body:''},"notes-delete":{body:'',hidden:!0},pipette:{body:''},play:{body:''},plus:{body:''},redo:{body:''},reload:{body:''},robot:{body:''},scale:{body:''},script:{body:''},search:{body:''},server:{body:''},sliders:{body:'',hidden:!0},trash:{body:'',hidden:!0},"trending-up":{body:'',hidden:!0},undo:{body:''},upload:{body:''},user:{body:''},"warning-box":{body:'',hidden:!0},zap:{body:''}},aliases:{code:{parent:"brackets-angle"}},width:24,height:24},fn=parseInt($n.replace(/\D+/g,"")),Ei=fn>=125?"uv1":"uv2";var et=Uint8Array,Et=Uint16Array,nn=Uint32Array,xo=new et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bo=new et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_i=new et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mo=function(a,e){for(var t=new Et(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Se&21845)<<1;It=(It&52428)>>>2|(It&13107)<<2,It=(It&61680)>>>4|(It&3855)<<4,on[Se]=((It&65280)>>>8|(It&255)<<8)>>>1}var pr=(function(a,e,t){for(var n=a.length,r=0,o=new Et(e);r>>s]=h}else for(l=new Et(n),r=0;r>>15-a[r]);return l}),yr=new et(288);for(var Se=0;Se<144;++Se)yr[Se]=8;for(var Se=144;Se<256;++Se)yr[Se]=9;for(var Se=256;Se<280;++Se)yr[Se]=7;for(var Se=280;Se<288;++Se)yr[Se]=8;var Io=new et(32);for(var Se=0;Se<32;++Se)Io[Se]=5;var Ti=pr(yr,9,1),ki=pr(Io,5,1),$r=function(a){for(var e=a[0],t=1;te&&(e=a[t]);return e},ot=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},Xr=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Pi=function(a){return(a/8|0)+(a&7&&1)},Di=function(a,e,t){(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof Et?Et:a instanceof nn?nn:et)(t-e);return n.set(a.subarray(e,t)),n},Ri=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new et(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new et(n*3));var i=function(ue){var Re=e.length;if(ue>Re){var Fe=new et(Math.max(Re*2,ue));Fe.set(e),e=Fe}},l=t.f||0,s=t.p||0,h=t.b||0,m=t.l,u=t.d,d=t.m,z=t.n,b=n*8;do{if(!m){t.f=l=ot(a,s,1);var y=ot(a,s+1,3);if(s+=3,y)if(y==1)m=Ti,u=ki,d=9,z=5;else if(y==2){var H=ot(a,s,31)+257,E=ot(a,s+10,15)+4,C=H+ot(a,s+5,31)+1;s+=14;for(var v=new et(C),A=new et(19),_=0;_>>4;if(M<16)v[_++]=M;else{var F=0,R=0;for(M==16?(R=3+ot(a,s,3),s+=2,F=v[_-1]):M==17?(R=3+ot(a,s,7),s+=3):M==18&&(R=11+ot(a,s,127),s+=7);R--;)v[_++]=F}}var p=v.subarray(0,H),T=v.subarray(H);d=$r(p),z=$r(T),m=pr(p,d,1),u=pr(T,z,1)}else throw"invalid block type";else{var M=Pi(s)+4,S=a[M-4]|a[M-3]<<8,g=M+S;if(g>n){if(o)throw"unexpected EOF";break}r&&i(h+S),e.set(a.subarray(M,g),h),t.b=h+=S,t.p=s=g*8;continue}if(s>b){if(o)throw"unexpected EOF";break}}r&&i(h+131072);for(var Q=(1<>>4;if(s+=F&15,s>b){if(o)throw"unexpected EOF";break}if(!F)throw"invalid length/literal";if(K<256)e[h++]=K;else if(K==256){Z=s,m=null;break}else{var te=K-254;if(K>264){var _=K-257,oe=xo[_];te=ot(a,s,(1<>>4;if(!ie)throw"invalid distance";s+=ie&15;var T=Li[_e];if(_e>3){var oe=bo[_e];T+=Xr(a,s)&(1<b){if(o)throw"unexpected EOF";break}r&&i(h+131072);for(var De=h+te;h>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ur(a,e){return Ri((ji(a),a.subarray(2,-4)),e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ui=0;try{Oi.decode(Fi,{stream:!0}),Ui=1}catch{}const Bi=a=>a&&a.isCubeTexture;class Ni extends Ft{constructor(e,t){var n,r;const o=Bi(e),l=((r=o?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,s=Math.floor(Math.log2(l)),h=Math.pow(2,s),m=3*Math.max(h,112),u=4*h,d=[o?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/u}`,`#define CUBEUV_MAX_MIP ${s}.0`],z=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,b=d.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${fn>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,y={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},M=new Go(1,16),S=new qt({uniforms:y,fragmentShader:b,vertexShader:z,side:Er});super(M,S)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}function Co(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0,n=a.length;t=t[n])return n-1;if(e<=t[a])return a;let r=a,o=n,i=Math.floor((r+o)/2);for(;e=t[i+1];)e=y&&(b[z][0]=b[d][0]/l[g+1][S],M=b[z][0]*l[S][g]);const H=S>=-1?1:-S,E=u-1<=g?y-1:t-u;for(let v=H;v<=E;++v)b[z][v]=(b[d][v]-b[d][v-1])/l[g+1][S+v],M+=b[z][v]*l[S+v][g];u<=g&&(b[z][y]=-b[d][y-1]/l[g+1][u],M+=b[z][y]*l[u][g]),i[y][u]=M;const C=d;d=z,z=C}}let m=t;for(let u=1;u<=n;++u){for(let d=0;d<=t;++d)i[u][d]*=m;m*=t-u}return i}function Zi(a,e,t,n,r){const o=r0,s=typeof o.Content=="string"&&o.Content!=="";if(l||s){const h=this.parseImage(n[r]);t[o.RelativeFilename||o.Filename]=h}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(r){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in he.Objects){const n=he.Objects.Texture;for(const r in n){const o=this.parseTexture(n[r],e);t.set(parseInt(r),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,o=e.WrapModeV,i=r!==void 0?r.value:0,l=o!==void 0?o.value:0;if(n.wrapS=i===0?zn:ct,n.wrapT=l===0?zn:ct,"Scaling"in e){const s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const l=e.FileName.slice(-3).toLowerCase();if(l==="tga"){const s=this.manager.getHandler(".tga");s===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ht):(s.setPath(this.textureLoader.path),i=s.load(n))}else l==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ht):i=this.textureLoader.load(n);return this.textureLoader.setPath(r),i}parseMaterials(e){const t=new Map;if("Material"in he.Objects){const n=he.Objects.Material;for(const r in n){const o=this.parseMaterial(n[r],e);o!==null&&t.set(parseInt(r),o)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(n))return null;const i=this.parseParameters(e,t,n);let l;switch(o.toLowerCase()){case"phong":l=new Nr;break;case"lambert":l=new Zn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),l=new Nr;break}return l.setValues(i),l.name=r,l}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new at().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new at().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new at().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new at().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new at().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new at().fromArray(e.SpecularColor.value));const o=this;return Ae.get(n).children.forEach(function(i){const l=i.relationship;switch(l){case"Bump":r.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(t,i.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(t,i.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=o.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=Yn,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=o.getTexture(t,i.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(t,i.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in he.Objects&&t in he.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in he.Objects){const n=he.Objects.Deformer;for(const r in n){const o=n[r],i=Ae.get(parseInt(r));if(o.attrType==="Skin"){const l=this.parseSkeleton(i,n);l.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=i.parents[0].ID,e[r]=l}else if(o.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(i,n),l.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const o=t[r.ID];if(o.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new Ce().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r1?i=l:l.length>0?i=l[0]:(i=new Nr({color:13421772}),l.push(i)),"color"in o.attributes&&l.forEach(function(s){s.vertexColors=!0}),o.FBX_Deformer?(r=new Ko(o,i),r.normalizeSkinWeights()):r=new Ft(o,i),r}createCurve(e,t){const n=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),r=new qn({color:3342591,linewidth:1});return new qo(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ho(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const o=he.Objects.Model[r.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Ue.add(e.target)):e.lookAt(new fe().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(s){if(t.has(s.ID)){const h=s.ID;Ae.get(h).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new Qo(i.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in he.Objects){const t=he.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(o){e[o.Node]=new Ce().fromArray(o.Matrix.a)}):e[r.Node]=new Ce().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in he&&"AmbientColor"in he.GlobalSettings){const e=he.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const o=new at(t,n,r);Ue.add(new Jo(o,1))}}}}class Ji{parse(e){const t=new Map;if("Geometry"in he.Objects){const n=he.Objects.Geometry;for(const r in n){const o=Ae.get(parseInt(r)),i=this.parseGeometry(o,n[r],e);t.set(parseInt(r),i)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,o=[],i=e.parents.map(function(u){return he.Objects.Model[u.ID]});if(i.length===0)return;const l=e.children.reduce(function(u,d){return r[d.ID]!==void 0&&(u=r[d.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&o.push(n.morphTargets[u.ID])});const s=i[0],h={};"RotationOrder"in s&&(h.eulerOrder=Ho(s.RotationOrder.value)),"InheritType"in s&&(h.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(h.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(h.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(h.scale=s.GeometricScaling.value);const m=Ao(h);return this.genGeometry(t,l,o,m)}genGeometry(e,t,n,r){const o=new cr;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),l=this.genBuffers(i),s=new Pt(l.vertex,3);if(s.applyMatrix4(r),o.setAttribute("position",s),l.colors.length>0&&o.setAttribute("color",new Pt(l.colors,3)),t&&(o.setAttribute("skinIndex",new ea(l.weightsIndices,4)),o.setAttribute("skinWeight",new Pt(l.vertexWeights,4)),o.FBX_Deformer=t),l.normal.length>0){const h=new ta().getNormalMatrix(r),m=new Pt(l.normal,3);m.applyNormalMatrix(h),o.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){Ei==="uv2"&&m++;const u=m===0?"uv":`uv${m}`;o.setAttribute(u,new Pt(l.uvs[m],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,d){u!==h&&(o.addGroup(m,d-m,h),h=u,m=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==l.materialIndex.length&&o.addGroup(d,l.materialIndex.length-d,h)}o.groups.length===0&&o.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(o,e,n,r),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,o){r.indices.forEach(function(i,l){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:o,weight:r.weights[l]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,o=!1,i=[],l=[],s=[],h=[],m=[],u=[];const d=this;return e.vertexIndices.forEach(function(z,b){let y,M=!1;z<0&&(z=z^-1,M=!0);let S=[],g=[];if(i.push(z*3,z*3+1,z*3+2),e.color){const H=Mr(b,n,z,e.color);s.push(H[0],H[1],H[2])}if(e.skeleton){if(e.weightTable[z]!==void 0&&e.weightTable[z].forEach(function(H){g.push(H.weight),S.push(H.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const H=[0,0,0,0],E=[0,0,0,0];g.forEach(function(C,v){let A=C,_=S[v];E.forEach(function(D,j,q){if(A>D){q[j]=A,A=D;const B=H[j];H[j]=_,_=B}})}),S=H,g=E}for(;g.length<4;)g.push(0),S.push(0);for(let H=0;H<4;++H)m.push(g[H]),u.push(S[H])}if(e.normal){const H=Mr(b,n,z,e.normal);l.push(H[0],H[1],H[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Mr(b,n,z,e.material)[0]),e.uv&&e.uv.forEach(function(H,E){const C=Mr(b,n,z,H);h[E]===void 0&&(h[E]=[]),h[E].push(C[0]),h[E].push(C[1])}),r++,M&&(d.genFace(t,e,i,y,l,s,h,m,u,r),n++,r=0,i=[],l=[],s=[],h=[],m=[],u=[])}),t}genFace(e,t,n,r,o,i,l,s,h,m){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ra(e.name,-1,t)}generateTracks(e){const t=[];let n=new fe,r=new $e,o=new fe;if(e.transform&&e.transform.decompose(n,r,o),n=n.toArray(),r=new hr().setFromQuaternion(r,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,n);return new na(e+"."+r,o,i)}generateRotationTrack(e,t,n,r,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Be.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Be.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Be.degToRad));const l=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(l,t,n);r!==void 0&&(r=r.map(Be.degToRad),r.push(i),r=new hr().fromArray(r),r=new $e().setFromEuler(r)),o!==void 0&&(o=o.map(Be.degToRad),o.push(i),o=new hr().fromArray(o),o=new $e().setFromEuler(o).invert());const h=new $e,m=new hr,u=[];for(let d=0;d1){let n=1,r=t[0];for(let o=1;o=180){const i=o/180,l=r/i;let s=n+l;const h=e.times[t-1],u=(e.times[t]-h)/i;let d=h+u;const z=[],b=[];for(;d1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,o);return}if(r==="C"){const s=o.split(",").slice(1),h=parseInt(s[0]),m=parseInt(s[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),r="connections",o=[h,m],ss(o,u),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=o),r in i&&Array.isArray(i[r])?i[r].push(o):r!=="a"?i[r]=o:i.a=o,this.setCurrentProp(i,r),r==="a"&&o.slice(-1)!==","&&(i.a=Yr(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yr(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=r[0],i=r[1],l=r[2],s=r[3];let h=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Yr(h);break}this.getPrevNode()[o]={type:i,type2:l,flag:s,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class rs{parse(e){const t=new Bn(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new _o;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&r.add(o.name,o)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),l=e.getString(i);if(r===0)return null;const s=[];for(let d=0;d0?s[0]:"",m=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(l,n,d)}return n.propertyList=s,typeof h=="number"&&(n.id=h),m!==""&&(n.attrName=m),u!==""&&(n.attrType=u),l!==""&&(n.name=l),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(o,i){i!==0&&r.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],o=n.propertyList[1];const i=n.propertyList[2],l=n.propertyList[3];let s;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?s=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:s=n.propertyList[4],t[r]={type:o,type2:i,flag:l,value:s}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=ur(new Uint8Array(e.getArrayBuffer(i))),s=new Bn(l.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Bn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(t=t.slice(0,n)),Co(new Uint8Array(t))}}class _o{add(e,t){this[e]=t}}function ns(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Lo(a,0,e.length)}function os(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const o=a[r-1];return a=a.slice(t+r),t++,o}for(let r=0;r(F=T.indexOf(` +`))&&R=_.byteLength||!(p=u(_)))&&i(1,"no header found"),(T=p.match(D))||i(3,"bad initial token"),R.valid|=1,R.programtype=T[1],R.string+=p+` +`;p=u(_),p!==!1;){if(R.string+=p+` +`,p.charAt(0)==="#"){R.comments+=p+` +`;continue}if((T=p.match(j))&&(R.gamma=parseFloat(T[1])),(T=p.match(q))&&(R.exposure=parseFloat(T[1])),(T=p.match(B))&&(R.valid|=2,R.format=T[1]),(T=p.match(F))&&(R.valid|=4,R.height=parseInt(T[1],10),R.width=parseInt(T[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},z=function(_,D,j){const q=D;if(q<8||q>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);q!==(_[2]<<8|_[3])&&i(3,"wrong scanline width");const B=new Uint8Array(4*D*j);B.length||i(4,"unable to allocate buffer space");let F=0,R=0;const p=4*q,T=new Uint8Array(4),Q=new Uint8Array(p);let V=j;for(;V>0&&R<_.byteLength;){R+4>_.byteLength&&i(1),T[0]=_[R++],T[1]=_[R++],T[2]=_[R++],T[3]=_[R++],(T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=q)&&i(3,"bad rgbe scanline format");let Z=0,K;for(;Z128;if(oe&&(K-=128),(K===0||Z+K>p)&&i(3,"bad scanline data"),oe){const ie=_[R++];for(let _e=0;_e=152;class hs extends Qn{constructor(e){super(e),this.type=Xe}parse(e){const D=Math.pow(2.7182818,2.2);function j(c,f){for(var x=0,L=0;L<65536;++L)(L==0||c[L>>3]&1<<(L&7))&&(f[x++]=L);for(var k=x-1;x<65536;)f[x++]=0;return k}function q(c){for(var f=0;f<16384;f++)c[f]={},c[f].len=0,c[f].lit=0,c[f].p=null}const B={l:0,c:0,lc:0};function F(c,f,x,L,k){for(;x>x&(1<0;--f){var L=x+R[f]>>1;R[f]=x,x=L}for(var f=0;f<65537;++f){var k=c[f];k>0&&(c[f]=k|R[k]++<<6)}}function T(c,f,x,L,k,P,N){for(var U=x,$=0,W=0;k<=P;k++){if(U.value-x.value>L)return!1;F(6,$,W,c,U);var X=B.l;if($=B.c,W=B.lc,N[k]=X,X==63){if(U.value-x.value>L)throw"Something wrong with hufUnpackEncTable";F(8,$,W,c,U);var G=B.l+6;if($=B.c,W=B.lc,k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}else if(X>=59){var G=X-59+2;if(k+G>P+1)throw"Something wrong with hufUnpackEncTable";for(;G--;)N[k++]=0;k--}}p(N)}function Q(c){return c&63}function V(c){return c>>6}function Z(c,f,x,L){for(;f<=x;f++){var k=V(c[f]),P=Q(c[f]);if(k>>P)throw"Invalid table entry";if(P>14){var N=L[k>>P-14];if(N.len)throw"Invalid table entry";if(N.lit++,N.p){var U=N.p;N.p=new Array(N.lit);for(var $=0;$0;$--){var N=L[(k<<14-P)+W];if(N.len||N.p)throw"Invalid table entry";N.len=P,N.lit=f,W++}}return!0}const K={c:0,lc:0};function te(c,f,x,L){c=c<<8|rt(x,L),f+=8,K.c=c,K.lc=f}const oe={c:0,lc:0};function ie(c,f,x,L,k,P,N,U,$,W){if(c==f){L<8&&(te(x,L,k,N),x=K.c,L=K.lc),L-=8;var X=x>>L,X=new Uint8Array([X])[0];if($.value+X>W)return!1;for(var G=U[$.value-1];X-- >0;)U[$.value++]=G}else if($.value32767?f-65536:f}const ue={a:0,b:0};function Re(c,f){var x=De(c),L=De(f),k=L,P=x+(k&1)+(k>>1),N=P,U=P-k;ue.a=N,ue.b=U}function Fe(c,f){var x=_e(c),L=_e(f),k=x-(L>>1)&65535,P=L+k-32768&65535;ue.a=P,ue.b=k}function _t(c,f,x,L,k,P,N){for(var U=N<16384,$=x>k?k:x,W=1,X;W<=$;)W<<=1;for(W>>=1,X=W,W>>=1;W>=1;){for(var G=0,Ee=G+P*(k-X),ee=P*W,re=P*X,se=L*W,ce=L*X,we,be,Le,Oe;G<=Ee;G+=re){for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se,ke=Me+ee,vt=ke+se;U?(Re(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Re(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Re(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Re(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b):(Fe(c[Me+f],c[ke+f]),we=ue.a,Le=ue.b,Fe(c[ze+f],c[vt+f]),be=ue.a,Oe=ue.b,Fe(we,be),c[Me+f]=ue.a,c[ze+f]=ue.b,Fe(Le,Oe),c[ke+f]=ue.a,c[vt+f]=ue.b)}if(x&W){var ke=Me+ee;U?Re(c[Me+f],c[ke+f]):Fe(c[Me+f],c[ke+f]),we=ue.a,c[ke+f]=ue.b,c[Me+f]=we}}if(k&W)for(var Me=G,st=G+L*(x-X);Me<=st;Me+=ce){var ze=Me+se;U?Re(c[Me+f],c[ze+f]):Fe(c[Me+f],c[ze+f]),we=ue.a,c[ze+f]=ue.b,c[Me+f]=we}X=W,W>>=1}return G}function tt(c,f,x,L,k,P,N,U,$,W){for(var X=0,G=0,Ee=U,ee=Math.trunc(k.value+(P+7)/8);k.value=14;){var re=X>>G-14&16383,se=f[re];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else{if(!se.p)throw"hufDecode issues";var ce;for(ce=0;ce=we&&V(c[se.p[ce]])==(X>>G-we&(1<>=be,G-=be;G>0;){var se=f[X<<14-G&16383];if(se.len)G-=se.len,ie(se.lit,N,X,G,x,L,k,$,W,Ee),X=oe.c,G=oe.lc;else throw"hufDecode issues"}return!0}function yt(c,f,x,L,k,P){var N={value:0},U=x.value,$=pe(f,x),W=pe(f,x);x.value+=4;var X=pe(f,x);if(x.value+=4,$<0||$>=65537||W<0||W>=65537)throw"Something wrong with HUF_ENCSIZE";var G=new Array(65537),Ee=new Array(16384);q(Ee);var ee=L-(x.value-U);if(T(c,f,x,ee,$,W,G),X>8*(L-(x.value-U)))throw"Something wrong with hufUncompress";Z(G,$,W,Ee),tt(G,Ee,c,f,x,X,W,P,k,N)}function At(c,f,x){for(var L=0;LP||(f[k++]=c[x++],k>P));)f[k++]=c[L++]}function it(c){for(var f=c.byteLength,x=new Array,L=0,k=new DataView(c);f>0;){var P=k.getInt8(L++);if(P<0){var N=-P;f-=N+1;for(var U=0;U>8==255?k+=L&255:(x[k]=L,k++),c.value++}function Bt(c,f){f[0]=J(c[0]),f[1]=J(c[1]),f[2]=J(c[5]),f[3]=J(c[6]),f[4]=J(c[14]),f[5]=J(c[15]),f[6]=J(c[27]),f[7]=J(c[28]),f[8]=J(c[2]),f[9]=J(c[4]),f[10]=J(c[7]),f[11]=J(c[13]),f[12]=J(c[16]),f[13]=J(c[26]),f[14]=J(c[29]),f[15]=J(c[42]),f[16]=J(c[3]),f[17]=J(c[8]),f[18]=J(c[12]),f[19]=J(c[17]),f[20]=J(c[25]),f[21]=J(c[30]),f[22]=J(c[41]),f[23]=J(c[43]),f[24]=J(c[9]),f[25]=J(c[11]),f[26]=J(c[18]),f[27]=J(c[24]),f[28]=J(c[31]),f[29]=J(c[40]),f[30]=J(c[44]),f[31]=J(c[53]),f[32]=J(c[10]),f[33]=J(c[19]),f[34]=J(c[23]),f[35]=J(c[32]),f[36]=J(c[39]),f[37]=J(c[45]),f[38]=J(c[52]),f[39]=J(c[54]),f[40]=J(c[20]),f[41]=J(c[22]),f[42]=J(c[33]),f[43]=J(c[38]),f[44]=J(c[46]),f[45]=J(c[51]),f[46]=J(c[55]),f[47]=J(c[60]),f[48]=J(c[21]),f[49]=J(c[34]),f[50]=J(c[37]),f[51]=J(c[47]),f[52]=J(c[50]),f[53]=J(c[56]),f[54]=J(c[59]),f[55]=J(c[61]),f[56]=J(c[35]),f[57]=J(c[36]),f[58]=J(c[48]),f[59]=J(c[49]),f[60]=J(c[57]),f[61]=J(c[58]),f[62]=J(c[62]),f[63]=J(c[63])}function Rr(c){const f=.5*Math.cos(.7853975),x=.5*Math.cos(3.14159/16),L=.5*Math.cos(3.14159/8),k=.5*Math.cos(3*3.14159/16),P=.5*Math.cos(5*3.14159/16),N=.5*Math.cos(3*3.14159/8),U=.5*Math.cos(7*3.14159/16);for(var $=new Array(4),W=new Array(4),X=new Array(4),G=new Array(4),Ee=0;Ee<8;++Ee){var ee=Ee*8;$[0]=L*c[ee+2],$[1]=N*c[ee+2],$[2]=L*c[ee+6],$[3]=N*c[ee+6],W[0]=x*c[ee+1]+k*c[ee+3]+P*c[ee+5]+U*c[ee+7],W[1]=k*c[ee+1]-U*c[ee+3]-x*c[ee+5]-P*c[ee+7],W[2]=P*c[ee+1]-x*c[ee+3]+U*c[ee+5]+k*c[ee+7],W[3]=U*c[ee+1]-P*c[ee+3]+k*c[ee+5]-x*c[ee+7],X[0]=f*(c[ee+0]+c[ee+4]),X[3]=f*(c[ee+0]-c[ee+4]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[ee+0]=G[0]+W[0],c[ee+1]=G[1]+W[1],c[ee+2]=G[2]+W[2],c[ee+3]=G[3]+W[3],c[ee+4]=G[3]-W[3],c[ee+5]=G[2]-W[2],c[ee+6]=G[1]-W[1],c[ee+7]=G[0]-W[0]}for(var re=0;re<8;++re)$[0]=L*c[16+re],$[1]=N*c[16+re],$[2]=L*c[48+re],$[3]=N*c[48+re],W[0]=x*c[8+re]+k*c[24+re]+P*c[40+re]+U*c[56+re],W[1]=k*c[8+re]-U*c[24+re]-x*c[40+re]-P*c[56+re],W[2]=P*c[8+re]-x*c[24+re]+U*c[40+re]+k*c[56+re],W[3]=U*c[8+re]-P*c[24+re]+k*c[40+re]-x*c[56+re],X[0]=f*(c[re]+c[32+re]),X[3]=f*(c[re]-c[32+re]),X[1]=$[0]+$[3],X[2]=$[1]-$[2],G[0]=X[0]+X[1],G[1]=X[3]+X[2],G[2]=X[3]-X[2],G[3]=X[0]-X[1],c[0+re]=G[0]+W[0],c[8+re]=G[1]+W[1],c[16+re]=G[2]+W[2],c[24+re]=G[3]+W[3],c[32+re]=G[3]-W[3],c[40+re]=G[2]-W[2],c[48+re]=G[1]-W[1],c[56+re]=G[0]-W[0]}function wr(c){for(var f=0;f<64;++f){var x=c[0][f],L=c[1][f],k=c[2][f];c[0][f]=x+1.5747*k,c[1][f]=x-.1873*L-.4682*k,c[2][f]=x+1.8556*L}}function Fr(c,f,x){for(var L=0;L<64;++L)f[x+L]=Zt.toHalfFloat(jr(c[L]))}function jr(c){return c<=1?Math.sign(c)*Math.pow(Math.abs(c),2.2):Math.sign(c)*Math.pow(D,Math.abs(c)-1)}function Nt(c){return new DataView(c.array.buffer,c.offset.value,c.size)}function Or(c){var f=c.viewer.buffer.slice(c.offset.value,c.offset.value+c.size),x=new Uint8Array(it(f)),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Vt(c){var f=c.array.slice(c.offset.value,c.offset.value+c.size),x=ur(f),L=new Uint8Array(x.length);return Ve(x),Ot(x,L),new DataView(L.buffer)}function Ur(c){for(var f=c.viewer,x={value:c.offset.value},L=new Uint16Array(c.width*c.scanlineBlockSize*(c.channels*c.type)),k=new Uint8Array(8192),P=0,N=new Array(c.channels),U=0;U=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if($<=W)for(var U=0;U0;){var U=Y(f.buffer,x),$=Ge(f,x),W=$>>2&3,X=($>>4)-1,G=new Int8Array([X])[0],Ee=Ge(f,x);P.push({name:U,index:G,type:Ee,compression:W}),N-=U.length+3}for(var ee=pt.channels,re=new Array(c.channels),se=0;se=0&&(be.idx[Oe.index]=Le),ce.offset=Le)}if(k.acCompressedSize>0)switch(k.acCompression){case 0:var ze=new Uint16Array(k.totalAcUncompressedCount);yt(c.array,f,x,k.acCompressedSize,ze,k.totalAcUncompressedCount);break;case 1:var Me=c.array.slice(x.value,x.value+k.totalAcUncompressedCount),st=ur(Me),ze=new Uint16Array(st.buffer);x.value+=k.totalAcUncompressedCount;break}if(k.dcCompressedSize>0){var ke={array:c.array,offset:x,size:k.dcCompressedSize},vt=new Uint16Array(Vt(ke).buffer);x.value+=k.dcCompressedSize}if(k.rleRawSize>0){var Me=c.array.slice(x.value,x.value+k.rleCompressedSize),st=ur(Me),nr=it(st.buffer);x.value+=k.rleCompressedSize}for(var Ye=0,xe=new Array(re.length),se=0;se>10,x=c&1023;return(c>>15?-1:1)*(f?f===31?x?NaN:1/0:Math.pow(2,f-15)*(1+x/1024):6103515625e-14*(x/1024))}function nt(c,f){var x=c.getUint16(f.value,!0);return f.value+=2,x}function wt(c,f){return J(nt(c,f))}function xt(c,f,x,L){for(var k=x.value,P=[];x.valuele.height?le.height-f:le.scanlineBlockSize;const L=le.size=le.height)break;for(let N=0;Na===Object(a)&&!Array.isArray(a)&&typeof a!="function";function mn(a,e){const t=Ne(o=>o.gl),n=ft(kr,Kr(a)?Object.values(a):a);return I.useLayoutEffect(()=>{e?.(n)},[e]),I.useEffect(()=>{if("initTexture"in t){let o=[];Array.isArray(n)?o=n:n instanceof ht?o=[n]:Kr(n)&&(o=Object.values(n)),o.forEach(i=>{i instanceof ht&&t.initTexture(i)})}},[t,n]),I.useMemo(()=>{if(Kr(a)){const o={};let i=0;for(const l in a)o[l]=n[i++];return o}else return n},[a,n])}mn.preload=a=>ft.preload(kr,a);mn.clear=a=>ft.clear(kr,a);const us=()=>parseInt($n.replace(/\D+/g,"")),ko=us();function pn(a){return ft(dn,a)}pn.preload=a=>ft.preload(dn,a);pn.clear=a=>ft.clear(dn,a);function fs(a,e){const t=I.useRef(null),[n]=I.useState(()=>e?e instanceof dr?{current:e}:e:t),[r]=I.useState(()=>new ca(void 0));I.useLayoutEffect(()=>{e&&(n.current=e instanceof dr?e:e.current),r._root=n.current});const o=I.useRef({}),i=I.useMemo(()=>{const l={};return a.forEach(s=>Object.defineProperty(l,s.name,{enumerable:!0,get(){if(n.current)return o.current[s.name]||(o.current[s.name]=r.clipAction(s,n.current))},configurable:!0})),{ref:n,clips:a,actions:l,names:a.map(s=>s.name),mixer:r}},[a]);return jt((l,s)=>r.update(s)),I.useEffect(()=>{const l=n.current;return()=>{o.current={},r.stopAllAction(),Object.values(i.actions).forEach(s=>{l&&r.uncacheAction(s,l)})}},[a]),i}const ds=I.forwardRef(function({children:e,object:t,disable:n,disableX:r,disableY:o,disableZ:i,left:l,right:s,top:h,bottom:m,front:u,back:d,onCentered:z,precise:b=!0,cacheKey:y=0,...M},S){const g=I.useRef(null),H=I.useRef(null),E=I.useRef(null),[C]=I.useState(()=>new Jn),[v]=I.useState(()=>new fe),[A]=I.useState(()=>new ha);return I.useLayoutEffect(()=>{H.current.matrixWorld.identity(),C.setFromObject(t??E.current,b);const _=C.max.x-C.min.x,D=C.max.y-C.min.y,j=C.max.z-C.min.z;C.getCenter(v),C.getBoundingSphere(A);const q=h?D/2:m?-D/2:0,B=l?-_/2:s?_/2:0,F=u?j/2:d?-j/2:0;H.current.position.set(n||r?0:-v.x+B,n||o?0:-v.y+q,n||i?0:-v.z+F),z?.({parent:g.current.parent,container:g.current,width:_,height:D,depth:j,boundingBox:C,boundingSphere:A,center:v,verticalAlignment:q,horizontalAlignment:B,depthAlignment:F})},[y,z,h,l,u,n,r,o,i,t,b,s,m,d,C,v,A]),I.useImperativeHandle(S,()=>g.current,[]),I.createElement("group",Ct({ref:g},M),I.createElement("group",{ref:H},I.createElement("group",{ref:E},e)))}),ms=To({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");var Qe=(function(a){return a[a.NONE=0]="NONE",a[a.START=1]="START",a[a.ACTIVE=2]="ACTIVE",a})(Qe||{});const Xt=a=>a&&a.isOrthographicCamera,ps=a=>a&&a.isBox3,vs=a=>1-Math.exp(-5*a)+.007*a,Po=I.createContext(null);function gs({children:a,maxDuration:e=1,margin:t=1.2,observe:n,fit:r,clip:o,interpolateFunc:i=vs,onFit:l}){const s=I.useRef(null),{camera:h,size:m,invalidate:u}=Ne(),d=Ne(C=>C.controls),z=I.useRef(l);z.current=l;const b=I.useRef({camPos:new fe,camRot:new $e,camZoom:1}),y=I.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),M=I.useRef(Qe.NONE),S=I.useRef(0),[g]=I.useState(()=>new Jn),H=I.useMemo(()=>{function C(){const v=g.getSize(new fe),A=g.getCenter(new fe),_=Math.max(v.x,v.y,v.z),D=Xt(h)?_*4:_/(2*Math.atan(Math.PI*h.fov/360)),j=Xt(h)?_*4:D/h.aspect,q=t*Math.max(D,j);return{box:g,size:v,center:A,distance:q}}return{getSize:C,refresh(v){if(ps(v))g.copy(v);else{const A=v||s.current;if(!A)return this;A.updateWorldMatrix(!0,!0),g.setFromObject(A)}if(g.isEmpty()){const A=h.position.length()||10;g.setFromCenterAndSize(new fe,new fe(A,A,A))}return b.current.camPos.copy(h.position),b.current.camRot.copy(h.quaternion),Xt(h)&&(b.current.camZoom=h.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){const{center:v,distance:A}=C(),_=h.position.clone().sub(v).normalize();y.current.camPos=v.clone().addScaledVector(_,A),y.current.target=v.clone();const D=new Ce().lookAt(y.current.camPos,y.current.target,h.up);return y.current.camRot=new $e().setFromRotationMatrix(D),M.current=Qe.START,S.current=0,this},moveTo(v){return y.current.camPos=Array.isArray(v)?new fe(...v):v.clone(),M.current=Qe.START,S.current=0,this},lookAt({target:v,up:A}){y.current.target=Array.isArray(v)?new fe(...v):v.clone(),A?y.current.camUp=Array.isArray(A)?new fe(...A):A.clone():y.current.camUp=h.up.clone();const _=new Ce().lookAt(y.current.camPos||h.position,y.current.target,y.current.camUp);return y.current.camRot=new $e().setFromRotationMatrix(_),M.current=Qe.START,S.current=0,this},to({position:v,target:A}){return this.moveTo(v).lookAt({target:A})},fit(){if(!Xt(h))return this.reset();let v=0,A=0;const _=[new fe(g.min.x,g.min.y,g.min.z),new fe(g.min.x,g.max.y,g.min.z),new fe(g.min.x,g.min.y,g.max.z),new fe(g.min.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.max.z),new fe(g.max.x,g.max.y,g.min.z),new fe(g.max.x,g.min.y,g.max.z),new fe(g.max.x,g.min.y,g.min.z)],D=y.current.camPos||h.position,j=y.current.target||d?.target,q=y.current.camUp||h.up,B=j?new Ce().lookAt(D,j,q).setPosition(D).invert():h.matrixWorldInverse;for(const p of _)p.applyMatrix4(B),v=Math.max(v,Math.abs(p.y)),A=Math.max(A,Math.abs(p.x));v*=2,A*=2;const F=(h.top-h.bottom)/v,R=(h.right-h.left)/A;return y.current.camZoom=Math.min(F,R)/t,M.current=Qe.START,S.current=0,z.current&&z.current(this.getSize()),this},clip(){const{distance:v}=C();return h.near=v/100,h.far=v*100,h.updateProjectionMatrix(),d&&(d.maxDistance=v*10,d.update()),u(),this}}},[g,h,d,t,u]);I.useLayoutEffect(()=>{if(d){const C=()=>{if(d&&y.current.target&&M.current!==Qe.NONE){const v=new fe().setFromMatrixColumn(h.matrix,2),A=b.current.camPos.distanceTo(d.target),_=(y.current.camPos||b.current.camPos).distanceTo(y.current.target),D=(1-S.current)*A+S.current*_;d.target.copy(h.position).addScaledVector(v,-D),d.update()}M.current=Qe.NONE};return d.addEventListener("start",C),()=>d.removeEventListener("start",C)}},[d]);const E=I.useRef(0);return I.useLayoutEffect(()=>{(n||E.current++===0)&&(H.refresh(),r&&H.reset().fit(),o&&H.clip())},[m,o,r,n,h,d]),jt((C,v)=>{if(M.current===Qe.START)M.current=Qe.ACTIVE,u();else if(M.current===Qe.ACTIVE){if(S.current+=v/e,S.current>=1)y.current.camPos&&h.position.copy(y.current.camPos),y.current.camRot&&h.quaternion.copy(y.current.camRot),y.current.camUp&&h.up.copy(y.current.camUp),y.current.camZoom&&Xt(h)&&(h.zoom=y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix(),d&&y.current.target&&(d.target.copy(y.current.target),d.update()),M.current=Qe.NONE;else{const A=i(S.current);y.current.camPos&&h.position.lerpVectors(b.current.camPos,y.current.camPos,A),y.current.camRot&&h.quaternion.slerpQuaternions(b.current.camRot,y.current.camRot,A),y.current.camUp&&h.up.set(0,1,0).applyQuaternion(h.quaternion),y.current.camZoom&&Xt(h)&&(h.zoom=(1-A)*b.current.camZoom+A*y.current.camZoom),h.updateMatrixWorld(),h.updateProjectionMatrix()}u()}}),I.createElement("group",{ref:s},I.createElement(Po.Provider,{value:H},a))}function ys(){return I.useContext(Po)}const Do=(a,e,t)=>{let n;switch(a){case Hr:n=new Uint8ClampedArray(e*t*4);break;case Xe:n=new Uint16Array(e*t*4);break;case pa:n=new Uint32Array(e*t*4);break;case ma:n=new Int8Array(e*t*4);break;case da:n=new Int16Array(e*t*4);break;case fa:n=new Int32Array(e*t*4);break;case gt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let zr;const ws=(a,e,t,n)=>{if(zr!==void 0)return zr;const r=new Jt(1,1,n);e.setRenderTarget(r);const o=new Ft(new sn,new Rt({color:16777215}));e.render(o,t),e.setRenderTarget(null);const i=Do(a,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,i),r.dispose(),o.geometry.dispose(),o.material.dispose(),zr=i[0]!==0,zr};class vn{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Qt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:ut,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:ut,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ct,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=vn.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eo,this._camera=new Kn,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!ws(this._type,this._renderer,this._camera,t)){let n;this._type===Xe&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?gt:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${gt}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ft(new sn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Jt(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Ar}static instantiateRenderer(){const e=new ua;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Do(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new to(this.toArray(),this.width,this.height,Qt,this._type,e?.mapping||Ar,e?.wrapS||ct,e?.wrapT||ct,e?.magFilter||ut,e?.minFilter||ut,e?.anisotropy||1,Qr);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof qt&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof ht&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof ht&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Ro extends Error{}class Fo extends Error{}const sr=(a,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(a);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(a);if(r){const o=r[1].match(/([^<]*)<\/rdf:li>/g);return o&&o.length===3?o.map(i=>i.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},xs=a=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(a):e=a.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const o=sr(r,"hdrgm:GainMapMin","0"),i=sr(r,"hdrgm:GainMapMax"),l=sr(r,"hdrgm:Gamma","1"),s=sr(r,"hdrgm:OffsetSDR","0.015625"),h=sr(r,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),u=m?m[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const z=d[1];return{gainMapMin:Array.isArray(o)?o.map(b=>parseFloat(b)):[parseFloat(o),parseFloat(o),parseFloat(o)],gainMapMax:Array.isArray(i)?i.map(b=>parseFloat(b)):[parseFloat(i),parseFloat(i),parseFloat(i)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:parseFloat(z)}}catch{}t=e.indexOf("{const r=this.options.debug,o=new DataView(e.buffer);if(o.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const i=o.byteLength;let l=2,s=0,h;for(;l250){n(new Error(`Found no marker after ${s} loops 😵`));return}if(o.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${o.getUint8(l).toString(16)}`));return}if(h=o.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const m=l+4;if(o.getUint32(m)===1297106432){const u=m+4;let d;if(o.getUint16(u)===18761)d=!1;else if(o.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(o.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const z=o.getUint32(u+4,!d);if(z<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=u+z,y=o.getUint16(b,!d),M=b+2;let S=0;for(let C=M;C{const e=xs(a);if(!e)throw new Fo("Gain map XMP metadata not found");const n=await new bs({extractFII:!0,extractNonFII:!0}).extract(a);if(n.length!==2)throw new Ro("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Gn=a=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(a)});class zs extends Xn{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new va}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ht,sdr:new ht});return this._config.createQuadRenderer({width:16,height:16,type:Xe,colorSpace:Qr,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,o=new Blob([e],{type:"image/jpeg"});let i,l,s=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([r?Gn(r):Promise.resolve(void 0),Gn(o)]);l=h[0],i=h[1],s=n==="flipY"}else{const h=await Promise.all([r?createImageBitmap(r,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:n||"flipY"})]);l=h[0],i=h[1]}return{sdrImage:i,gainMapImage:l,needsFlip:s}}createTextures(e,t,n){const r=new ht(t||new ImageData(2,2),Ar,ct,ct,ut,Cn,Qt,Hr,1,Qr);r.flipY=n,r.needsUpdate=!0;const o=new ht(e,Ar,ct,ct,ut,Cn,Qt,Hr,1,Yt);return o.flipY=n,o.needsUpdate=!0,{gainMap:r,sdr:o}}updateQuadRenderer(e,t,n,r,o){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=r,e.material.gainMapMin=o.gainMapMin,e.material.gainMapMax=o.gainMapMax,e.material.offsetHdr=o.offsetHdr,e.material.offsetSdr=o.offsetSdr,e.material.gamma=o.gamma,e.material.hdrCapacityMin=o.hdrCapacityMin,e.material.hdrCapacityMax=o.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),e.material.needsUpdate=!0}}const Ss=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,Is=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class Cs extends qt{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:o,maxDisplayBoost:i,hdrCapacityMin:l,hdrCapacityMax:s,sdr:h,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:Ss,fragmentShader:Is,uniforms:{sdr:{value:h},gainMap:{value:m},gamma:{value:new fe(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new fe().fromArray(t)},offsetSdr:{value:new fe().fromArray(n)},gainMapMin:{value:new fe().fromArray(r)},gainMapMax:{value:new fe().fromArray(o)},weightFactor:{value:(Math.log2(i)-l)/(s-l)}},blending:ga,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=l,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class jo extends zs{constructor(e,t){super({renderer:e,createMaterial:n=>new Cs(n),createQuadRenderer:n=>new vn(n)},t)}async render(e,t,n,r){const{sdrImage:o,gainMapImage:i,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:s,sdr:h}=this.createTextures(o,i,l);this.updateQuadRenderer(e,o,s,h,t),e.render()}}class Es extends jo{load([e,t,n],r,o,i){const l=this.prepareQuadRenderer();let s,h,m;const u=async()=>{if(s&&h&&m){try{await this.render(l,m,s,h)}catch(D){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof i=="function"&&i(D),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let d=!0,z=0,b=0,y=!0,M=0,S=0,g=!0,H=0,E=0;const C=()=>{if(typeof o=="function"){const D=z+M+H,j=b+S+E,q=d&&y&&g;o(new ProgressEvent("progress",{lengthComputable:q,loaded:j,total:D}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const v=new fr(this._internalLoadingManager);v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(this.withCredentials),v.load(e,async D=>{if(typeof D=="string")throw new Error("Invalid sdr buffer");s=D,await u()},D=>{d=D.lengthComputable,b=D.loaded,z=D.total,C()},D=>{this.manager.itemError(e),typeof i=="function"&&i(D)});const A=new fr(this._internalLoadingManager);A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setPath(this.path),A.setWithCredentials(this.withCredentials),A.load(t,async D=>{if(typeof D=="string")throw new Error("Invalid gainmap buffer");h=D,await u()},D=>{y=D.lengthComputable,S=D.loaded,M=D.total,C()},D=>{this.manager.itemError(t),typeof i=="function"&&i(D)});const _=new fr(this._internalLoadingManager);return _.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(n,async D=>{if(typeof D!="string")throw new Error("Invalid metadata string");m=JSON.parse(D),await u()},D=>{g=D.lengthComputable,E=D.loaded,H=D.total,C()},D=>{this.manager.itemError(n),typeof i=="function"&&i(D)}),l}}class _s extends jo{load(e,t,n,r){const o=this.prepareQuadRenderer(),i=new fr(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(l);let h,m,u;try{const d=await Ms(s);h=d.sdr,m=d.gainMap,u=d.metadata}catch(d){if(d instanceof Fo||d instanceof Ro)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=s;else throw d}try{await this.render(o,u,h.buffer,m?.buffer)}catch(d){this.manager.itemError(e),typeof r=="function"&&r(d),o.disposeOnDemandRenderer();return}typeof t=="function"&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),o}}const gr={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Oo="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Kt=a=>Array.isArray(a),gn=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function Dr({files:a=gn,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(yn(t),a=gr[t],e=Oo);const o=Kt(a),{extension:i,isCubemap:l}=wn(a),s=xn(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+a);const h=Ne(z=>z.gl);I.useLayoutEffect(()=>{if(i!=="webp"&&i!=="jpg"&&i!=="jpeg")return;function z(){ft.clear(s,o?[a]:a)}h.domElement.addEventListener("webglcontextlost",z,{once:!0})},[a,h.domElement]);const m=ft(s,o?[a]:a,z=>{(i==="webp"||i==="jpg"||i==="jpeg")&&z.setRenderer(h),z.setPath==null||z.setPath(e),r&&r(z)});let u=o?m[0]:m;if(i==="jpg"||i==="jpeg"||i==="webp"){var d;u=(d=u.renderTarget)==null?void 0:d.texture}return u.mapping=l?ya:Yn,u.colorSpace=n??(l?"srgb":"srgb-linear"),u}const As={files:gn,path:"",preset:void 0,extensions:void 0};Dr.preload=a=>{const e={...As,...a};let{files:t,path:n=""}=e;const{preset:r,extensions:o}=e;r&&(yn(r),t=gr[r],n=Oo);const{extension:i}=wn(t);if(i==="webp"||i==="jpg"||i==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=xn(i);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.preload(l,Kt(t)?[t]:t,s=>{s.setPath==null||s.setPath(n),o&&o(s)})};const Hs={files:gn,preset:void 0};Dr.clear=a=>{const e={...Hs,...a};let{files:t}=e;const{preset:n}=e;n&&(yn(n),t=gr[n]);const{extension:r}=wn(t),o=xn(r);if(!o)throw new Error("useEnvironment: Unrecognized file extension: "+t);ft.clear(o,Kt(t)?[t]:t)};function yn(a){if(!(a in gr))throw new Error("Preset must be one of: "+Object.keys(gr).join(", "))}function wn(a){var e;const t=Kt(a)&&a.length===6,n=Kt(a)&&a.length===3&&a.some(i=>i.endsWith("json")),r=Kt(a)?a[0]:a;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function xn(a){return a==="cube"?wa:a==="hdr"?cs:a==="exr"?hs:a==="jpg"||a==="jpeg"?_s:a==="webp"?Es:null}const Ls=a=>a.current&&a.current.isScene,Ts=a=>Ls(a)?a.current:a;function bn(a,e,t,n,r={}){var o,i,l,s;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=Ts(e||t),m=h.background,u=h.environment,d={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(o=(i=h.backgroundRotation)==null||i.clone==null?void 0:i.clone())!==null&&o!==void 0?o:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(s=h.environmentRotation)==null||s.clone==null?void 0:s.clone())!==null&&l!==void 0?l:[0,0,0]};return a!=="only"&&(h.environment=n),a&&(h.background=n),En(h,r),()=>{a!=="only"&&(h.environment=u),a&&(h.background=m),En(h,d)}}function Mn({scene:a,background:e=!1,map:t,...n}){const r=Ne(o=>o.scene);return I.useLayoutEffect(()=>{if(t)return bn(e,a,r,t,n)}),null}function Uo({background:a=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l,...s}){const h=Dr(s),m=Ne(u=>u.scene);return I.useLayoutEffect(()=>bn(a,e,m,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:o,environmentIntensity:i,environmentRotation:l})),I.useEffect(()=>()=>{h.dispose()},[h]),null}function ks({children:a,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:o,background:i=!1,blur:l,backgroundBlurriness:s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d,scene:z,files:b,path:y,preset:M=void 0,extensions:S}){const g=Ne(_=>_.gl),H=Ne(_=>_.scene),E=I.useRef(null),[C]=I.useState(()=>new eo),v=I.useMemo(()=>{const _=new xa(n);return _.texture.type=Xe,_},[n]);I.useEffect(()=>()=>{v.dispose()},[v]),I.useLayoutEffect(()=>{if(r===1){const _=g.autoClear;g.autoClear=!0,E.current.update(g,C),g.autoClear=_}return bn(i,z,H,v.texture,{backgroundBlurriness:l??s,backgroundIntensity:h,backgroundRotation:m,environmentIntensity:u,environmentRotation:d})},[a,C,v.texture,z,H,i,r,g]);let A=1;return jt(()=>{if(r===1/0||Aro({GroundProjectedEnvImpl:Ni}),[]),I.useEffect(()=>()=>{o.dispose()},[o]);const l=I.useMemo(()=>[i],[i]),s=(e=a.ground)==null?void 0:e.height,h=(t=a.ground)==null?void 0:t.radius,m=(n=(r=a.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return I.createElement(I.Fragment,null,I.createElement(Mn,Ct({},a,{map:i})),I.createElement("groundProjectedEnvImpl",{args:l,scale:m,height:s,radius:h}))}function Ds(a){return a.ground?I.createElement(Ps,a):a.map?I.createElement(Mn,a):a.children?I.createElement(ks,a):I.createElement(Uo,a)}const Rs=I.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:o=1,near:i=0,far:l=10,resolution:s=512,smooth:h=!0,color:m="#000000",depthWrite:u=!1,renderOrder:d,...z},b)=>{const y=I.useRef(null),M=Ne(R=>R.scene),S=Ne(R=>R.gl),g=I.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),r=r*(Array.isArray(a)?a[1]:a||1);const[H,E,C,v,A,_,D]=I.useMemo(()=>{const R=new Jt(s,s),p=new Jt(s,s);p.texture.generateMipmaps=R.texture.generateMipmaps=!1;const T=new sn(n,r).rotateX(Math.PI/2),Q=new Ft(T),V=new Ma;V.depthTest=V.depthWrite=!1,V.onBeforeCompile=te=>{te.uniforms={...te.uniforms,ucolor:{value:new at(m)}},te.fragmentShader=te.fragmentShader.replace("void main() {",`uniform vec3 ucolor; + void main() { + `),te.fragmentShader=te.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const Z=new qt(Vi),K=new qt(Gi);return K.depthTest=Z.depthTest=!1,[R,T,V,Q,Z,K,p]},[s,n,r,a,m]),j=R=>{v.visible=!0,v.material=A,A.uniforms.tDiffuse.value=H.texture,A.uniforms.h.value=R*1/256,S.setRenderTarget(D),S.render(v,g.current),v.material=_,_.uniforms.tDiffuse.value=D.texture,_.uniforms.v.value=R*1/256,S.setRenderTarget(H),S.render(v,g.current),v.visible=!1};let q=0,B,F;return jt(()=>{g.current&&(e===1/0||qy.current,[]),I.createElement("group",Ct({"rotation-x":Math.PI/2},z,{ref:y}),I.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},I.createElement("meshBasicMaterial",{transparent:!0,map:H.texture,opacity:t,depthWrite:u})),I.createElement("orthographicCamera",{ref:g,args:[-n/2,n/2,r/2,-r/2,i,l]}))});function Fs(a){return a.isLight}function js(a){return!!a.geometry}const Bo=I.createContext(null),Os=To({color:new at,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + }`,`varying vec2 vUv; + uniform sampler2D map; + uniform vec3 color; + uniform float opacity; + uniform float alphaTest; + uniform float blend; + void main() { + vec4 sampledDiffuseColor = texture2D(map, vUv); + gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); + #include + #include <${ko>=154?"colorspace_fragment":"encodings_fragment"}> + }`),Us=I.forwardRef(({children:a,temporal:e,frames:t=40,limit:n=1/0,blend:r=20,scale:o=10,opacity:i=1,alphaTest:l=.75,color:s="black",colorBlend:h=2,resolution:m=1024,toneMapped:u=!0,...d},z)=>{ro({SoftShadowMaterial:Os});const b=Ne(v=>v.gl),y=Ne(v=>v.scene),M=Ne(v=>v.camera),S=Ne(v=>v.invalidate),g=I.useRef(null),H=I.useRef(null),[E]=I.useState(()=>new Ns(b,y,m));I.useLayoutEffect(()=>{E.configure(g.current)},[]);const C=I.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?r:t),count:0,getMesh:()=>g.current,reset:()=>{E.clear();const v=g.current.material;v.opacity=0,v.alphaTest=0,C.count=0},update:(v=1)=>{const A=g.current.material;C.temporal?(A.opacity=Math.min(i,A.opacity+i/C.blend),A.alphaTest=Math.min(l,A.alphaTest+l/C.blend)):(A.opacity=i,A.alphaTest=l),H.current.visible=!0,E.prepare();for(let _=0;_D.update()),E.update(M,C.blend);H.current.visible=!1,E.finish()}}),[E,M,y,e,t,r,i,l]);return I.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),I.useImperativeHandle(z,()=>C,[C]),jt(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:H},I.createElement(Bo.Provider,{value:C},a)),I.createElement("mesh",{receiveShadow:!0,ref:g,scale:o,rotation:[-Math.PI/2,0,0]},I.createElement("planeGeometry",null),I.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:u,color:s,blend:h,map:E.progressiveLightMap2.texture})))}),Bs=I.forwardRef(({castShadow:a=!0,bias:e=.001,mapSize:t=512,size:n=5,near:r=.5,far:o=500,frames:i=1,position:l=[0,0,0],radius:s=1,amount:h=8,intensity:m=ko>=155?Math.PI:1,ambient:u=.5,...d},z)=>{const b=I.useRef(null),y=new fe(...l).length(),M=I.useContext(Bo),S=I.useCallback(()=>{let H;if(b.current)for(let E=0;Eu)H.position.set(l[0]+Be.randFloatSpread(s),l[1]+Be.randFloatSpread(s),l[2]+Be.randFloatSpread(s));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,v=2*Math.PI*Math.random();H.position.set(Math.cos(C)*Math.cos(v)*y,Math.abs(Math.cos(C)*Math.sin(v)*y),Math.sin(C)*y)}},[s,u,y,...l]),g=I.useMemo(()=>({update:S}),[S]);return I.useImperativeHandle(z,()=>g,[g]),I.useLayoutEffect(()=>{var H;const E=b.current;return M&&((H=M.lights)==null||H.set(E.uuid,g)),()=>{var C;M==null||(C=M.lights)==null?void 0:C.delete(E.uuid)}},[M,g]),I.createElement("group",Ct({ref:b},d),Array.from({length:h},(H,E)=>I.createElement("directionalLight",{key:E,castShadow:a,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:m/h},I.createElement("orthographicCamera",{attach:"shadow-camera",args:[-n,n,n,-n,r,o]}))))});class Ns{constructor(e,t,n=1024){this.renderer=e,this.res=n,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new at,this.clearAlpha=0;const r={type:Xe,magFilter:Je,minFilter:Je};this.progressiveLightMap1=new Jt(this.res,this.res,r),this.progressiveLightMap2=new Jt(this.res,this.res,r),this.discardMat=new ms,this.targetMat=new Zn({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=o=>{o.vertexShader=`varying vec2 vUv; +`+o.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const i=o.fragmentShader.indexOf("void main() {");o.fragmentShader=`varying vec2 vUv; +`+o.fragmentShader.slice(0,i)+`uniform sampler2D previousShadowMap; + uniform float averagingWindow; +`+o.fragmentShader.slice(i-1,-1)+` +vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; + gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); + }`,o.uniforms.previousShadowMap=this.previousShadowMap,o.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{js(e)?this.meshes.push({object:e,material:e.material}):Fs(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,r=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,o=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=r.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=o}}const Vs={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function Gs({radius:a,adjustCamera:e}){const t=ys();return I.useEffect(()=>{e&&t.refresh().clip().fit()},[a,e]),null}function Ws({children:a,center:e,adjustCamera:t=!0,intensity:n=.5,shadows:r="contact",environment:o="city",preset:i="rembrandt",...l}){var s,h,m,u,d,z,b,y;const M=typeof i=="string"?Vs[i]:i,[{radius:S,height:g},H]=I.useState({radius:0,width:0,height:0,depth:0}),E=(s=r?.bias)!==null&&s!==void 0?s:-1e-4,C=(h=r?.normalBias)!==null&&h!==void 0?h:0,v=(m=r?.size)!==null&&m!==void 0?m:1024,A=(u=r?.offset)!==null&&u!==void 0?u:0,_=r==="contact"||r?.type==="contact",D=r==="accumulative"||r?.type==="accumulative",j={...typeof r=="object"?r:{}},q=o?typeof o=="string"?{preset:o}:o:null,B=I.useCallback(F=>{const{width:R,height:p,depth:T,boundingSphere:Q}=F;H({radius:Q.radius,width:R,height:p,depth:T}),e!=null&&e.onCentered&&e.onCentered(F)},[]);return I.createElement(I.Fragment,null,I.createElement("ambientLight",{intensity:n/3}),I.createElement("spotLight",{penumbra:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],intensity:n*2,castShadow:!!r,"shadow-bias":E,"shadow-normalBias":C,"shadow-mapSize":v}),I.createElement("pointLight",{position:[M.fill[0]*S,M.fill[1]*S,M.fill[2]*S],intensity:n}),I.createElement(gs,Ct({fit:!!t,clip:!!t,margin:Number(t),observe:!0},l),I.createElement(Gs,{radius:S,adjustCamera:t}),I.createElement(ds,Ct({},e,{position:[0,A/2,0],onCentered:B}),a)),I.createElement("group",{position:[0,-g/2-A/2,0]},_&&I.createElement(Rs,Ct({scale:S*4,far:S,blur:2},j)),D&&I.createElement(Us,Ct({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:S*4},j),I.createElement(Bs,{amount:(d=j.amount)!==null&&d!==void 0?d:8,radius:(z=j.radius)!==null&&z!==void 0?z:S,ambient:(b=j.ambient)!==null&&b!==void 0?b:.5,intensity:(y=j.intensity)!==null&&y!==void 0?y:1,position:[M.main[0]*S,M.main[1]*S,M.main[2]*S],size:S*4,bias:-E,mapSize:v}))),o&&I.createElement(Ds,q))}function $s(a){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const t=e.getContext("2d");if(!t)throw new Error("Failed to create canvas context");return t.drawImage(a,0,0),t.getImageData(0,0,a.width,a.height)}function Xs(a){if(!a.width||!a.height)return!1;const e=a.width/64,t=Math.min(a.width-1,Math.max(0,Math.floor(55*e))),r=(Math.min(a.height-1,Math.max(0,Math.floor(20*e)))*a.width+t)*4+3;return a.data[r]===0}const an=a=>Xs($s(a));function Zs(a){const e=a.getContext("2d"),{width:t,height:n}=a,r=e.getImageData(0,0,t,n),o=r.data;for(let m=0;m0&&o[m+3]<255&&(o[m+3]=255);const i=(m,u)=>{const d=(u*t+m)*4;return[o[d],o[d+1],o[d+2],o[d+3]]},l=(m,u,d)=>{const z=(u*t+m)*4;o[z]=d[0],o[z+1]=d[1],o[z+2]=d[2],o[z+3]=d[3]},s=i(47,52)[3]===0;[[[[[8,8,8],[8,8]],[[8,8,8],[24,8]],[[8,8,8],[16,8]],[[8,8,8],[0,8]],[[8,8,8],[8,0]],[[8,8,8],[16,0]]],[32,0]],[[[[8,12,4],[20,20]],[[8,12,4],[32,20]],[[4,12,8],[28,20]],[[4,12,8],[16,20]],[[8,4,12],[20,16]],[[8,4,12],[28,16]]],[0,16]],[[[[s?3:4,12,4],[36,52]],[[s?3:4,12,4],[s?43:44,52]],[[4,12,4],[s?39:40,52]],[[4,12,4],[32,52]],[[s?3:4,4,12],[36,48]],[[s?3:4,4,12],[s?39:40,48]]],[16,0]],[[[[s?3:4,12,4],[44,20]],[[s?3:4,12,4],[s?51:52,20]],[[4,12,4],[s?47:48,20]],[[4,12,4],[40,20]],[[s?3:4,4,12],[44,16]],[[s?3:4,4,12],[s?47:48,16]]],[0,16]],[[[[4,12,4],[20,52]],[[4,12,4],[28,52]],[[4,12,4],[24,52]],[[4,12,4],[16,52]],[[4,4,12],[20,48]],[[4,4,12],[24,48]]],[-16,0]],[[[[4,12,4],[4,20]],[[4,12,4],[12,20]],[[4,12,4],[8,20]],[[4,12,4],[0,20]],[[4,4,12],[4,16]],[[4,4,12],[8,16]]],[0,16]]].forEach(m=>{const u=m[1],[d,z,b]=m[0][4][0],y={},M={},S=g=>{switch(g){case 0:return 0;case 1:return 1;case 4:return 2;case 5:return 3;case 2:return 4;case 3:return 5;default:return 99}};m[0].forEach((g,H)=>{const E=g[0],C=g[1];for(let v=0;v{i(E[0],E[1])[3]===0&&l(E[0],E[1],H.rgba)})}}),e.putImageData(r,0,0)}function Ys(a,e){const t=a.getContext("2d");if(!t)return;const n=t.getImageData(0,0,64,64),r=t.createImageData(64,64);r.data.set(n.data);const o=(y,M)=>{const S=(M*64+y)*4;return[n.data[S],n.data[S+1],n.data[S+2],n.data[S+3]]},i=(y,M,S)=>{if(y<0||y>=64||M<0||M>=64)return;const g=(M*64+y)*4;r.data[g]=S[0],r.data[g+1]=S[1],r.data[g+2]=S[2],r.data[g+3]=S[3]},l=[{loc:[40,16],overlay:[0,16]},{loc:[32,48],overlay:[16,0]}],s=[-1,-1,-1,-1,4,5,5,6,7,8,8,9,-1,-1,-1,-1],h=[0,1,2,3,4,5,5,6,7,8,9,10,11,12,12,13],m=[-1,-1,-1,-1,4,5,7,8,9,11,-2,-2,-2,-2,-2,-2],u=[0,1,2,3,4,5,7,8,9,10,11,12,13,15,-2,-2],d=e==="steve"?s:m,z=e==="steve"?h:u;for(const y of l)for(const M of[[0,0],y.overlay]){const S=y.loc[0]+M[0],g=y.loc[1]+M[1];for(let H=0;H<4;H++)for(let E=0;E<16;E++){const C=d[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}for(let H=4;H<16;H++)for(let E=0;E<16;E++){const C=z[E];C===-2?i(S+E,g+H,[0,0,0,0]):C!==-1&&i(S+E,g+H,o(S+C,g+H))}}const b=1335*4;e==="steve"?r.data[b+3]===0&&(r.data[b]=r.data[b-4],r.data[b+1]=r.data[b-3],r.data[b+2]=r.data[b-2],r.data[b+3]=r.data[b-1]||255):(r.data[b]=0,r.data[b+1]=0,r.data[b+2]=0,r.data[b+3]=0),t.putImageData(r,0,0)}function Ks({action:a,partsRefs:e,fbxUrl:t}){return a!=="dance"?null:w.jsx(qs,{partsRefs:e,fbxUrl:t},t)}function qs({partsRefs:a,fbxUrl:e="/fbx/Thriller Part 3.fbx"}){const t=pn(e),{actions:n}=fs(t.animations,t),r=I.useRef(null),o=new $e().setFromAxisAngle(new fe(0,0,1),Math.PI),i={head:new $e,body:new $e,left_arm:o,left_low_arm:o,right_arm:o,right_low_arm:o,left_leg:o,left_low_leg:o,right_leg:o,right_low_leg:o},l=I.useMemo(()=>({head:"head",body:"body","left up arm":"left_arm","left low arm":"left_low_arm","right up arm":"right_arm","right low arm":"right_low_arm","left up leg":"left_leg","left low leg":"left_low_leg","right up leg":"right_leg","right low leg":"right_low_leg"}),[]);return I.useEffect(()=>{const s=t.getObjectByName("body")||t.getObjectByName("Spine");s&&(r.current=s.position.clone());const h=n&&Object.values(n)[0];return h&&h.reset().play(),()=>{h&&h.stop(),Object.values(l).forEach(m=>{if(a.current&&a.current[m]){const u=a.current[m];u.quaternion.set(0,0,0,1),m==="body"&&u.position.set(0,10,0)}})}},[n,t,l,a]),jt(()=>{Object.entries(l).forEach(([s,h])=>{let m=t.getObjectByName(s);if(m||(m=t.getObjectByName(s.replace(/ /g,"_"))),m||t.traverse(u=>{u.name.replace(/[_ ]/g,"").toLowerCase()===s.replace(/ /g,"").toLowerCase()&&(m=u)}),m&&a.current&&a.current[h]){const u=a.current[h],d=new $e;m.getWorldQuaternion(d);const z=i[h]||new $e,b=d.clone().multiply(z.clone().invert()),y=new $e;u.parent&&u.parent.getWorldQuaternion(y);const M=y.clone().invert().multiply(b);if(u.quaternion.copy(M),h==="body"){r.current||(r.current=m.position.clone());const S=new fe().subVectors(m.position,r.current);S.multiplyScalar(.125),u.position.set(0,10,0).add(S)}}})}),w.jsx("group",{children:w.jsx("primitive",{object:t,visible:!1})})}function ye(a,e,t){const n={};return Object.keys(a).map(r=>{n[r]=[...a[r]],n[r][0]+=e,n[r][1]+=t}),n}function Qs(a,e,t){const n=e.front[2],r=e.right[2],o=e.front[3],i=t??o,l={};if(!a)return l;const s=a.data,h=a.width;for(const[m,u]of Object.entries(e)){const[d,z,b,y,M,S]=u,g=Math.floor(d),H=Math.floor(z),E=Math.floor(b),C=Math.floor(y),v=m==="left"||m==="right"||m==="front"||m==="back",A=v&&t&&t!==C?t:C;l[m]=[];for(let _=0;_{const s=i.front;if(!s)return;const[h,m,u,d]=s,z=Math.floor(u),b=Math.floor(d),y=(z-1)/2;for(let M=0;M=a.width||E<0||E>=a.height)continue;const C=(E*a.width+H)*4;if(a.data[C+3]===0)continue;const v=S*(z+1)+Math.abs(g-y);v{for(const S of b[M]){const g=`${S.x}_${S.y}_${S.z}`;y[g]||(y[g]={x:S.x,y:S.y,z:S.z}),y[g][M]=S.color,y[g][`${M}_u`]=S.u,y[g][`${M}_v`]=S.v}}),Object.values(y).forEach(M=>{const{x:S,y:g,z:H,left:E,right:C,top:v,bottom:A,front:_,back:D}=M,j=E??C??v??A??_??D,q=["left","right","top","bottom","front","back"].map(F=>{const R=M[F];return new Rt({color:R!==void 0?R:n?16777215:j,transparent:!0})}),B=new Ft(new Dt(u,d,z),q);B.position.set((S-.5)*u,(g-.5)*d,(H-.5)*z),B.userData={cell:M},o.add(B)}),t){const M={},S=(E,C)=>{const v=[E,C].sort((A,_)=>A[0]!==_[0]?A[0]-_[0]:A[1]!==_[1]?A[1]-_[1]:A[2]-_[2]);return`${v[0][0].toFixed(4)}_${v[0][1].toFixed(4)}_${v[0][2].toFixed(4)}|${v[1][0].toFixed(4)}_${v[1][1].toFixed(4)}_${v[1][2].toFixed(4)}`},g=(E,C,v)=>{const A=S(E,C);M[A]||(M[A]={p1:E,p2:C,faces:[]}),M[A].faces.push({normal:v})};Object.values(y).forEach(E=>{const{x:C,y:v,z:A}=E,_=(C-.5)*u,D=(v-.5)*d,j=(A-.5)*z,q=u/2,B=d/2,F=z/2,R=[[_-q,D-B,j-F],[_+q,D-B,j-F],[_+q,D+B,j-F],[_-q,D+B,j-F],[_-q,D-B,j+F],[_+q,D-B,j+F],[_+q,D+B,j+F],[_-q,D+B,j+F]];[{name:"left",offset:[1,0,0],normal:[1,0,0],v:[1,2,6,5]},{name:"right",offset:[-1,0,0],normal:[-1,0,0],v:[0,3,7,4]},{name:"top",offset:[0,1,0],normal:[0,1,0],v:[3,2,6,7]},{name:"bottom",offset:[0,-1,0],normal:[0,-1,0],v:[0,1,5,4]},{name:"front",offset:[0,0,1],normal:[0,0,1],v:[4,5,6,7]},{name:"back",offset:[0,0,-1],normal:[0,0,-1],v:[0,1,2,3]}].forEach(T=>{const Q=`${C+T.offset[0]}_${v+T.offset[1]}_${A+T.offset[2]}`;if(!y[Q]){const V=T.v;g(R[V[0]],R[V[1]],T.normal),g(R[V[1]],R[V[2]],T.normal),g(R[V[2]],R[V[3]],T.normal),g(R[V[3]],R[V[0]],T.normal)}})});const H=[];if(Object.values(M).forEach(E=>{if(E.faces.length===1)H.push(...E.p1,...E.p2);else if(E.faces.length>=2){const C=E.faces[0].normal,v=E.faces[1].normal,A=C[0]*v[0]+C[1]*v[1]+C[2]*v[2];Math.abs(A)<.01&&H.push(...E.p1,...E.p2)}}),H.length>0){const E=new cr;E.setAttribute("position",new Pt(H,3));const C=new qn({color:16777215}),v=new no(E,C);o.add(v)}}return o}function el({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",fbxUrl:r,visibleParts:o={},showOverlay:i=!0,updateTrigger:l=0,showEdges:s=!1,printMode:h=!1,onPaint:m,onHover:u,onHoverEnd:d}){return e?w.jsx(Vo,{texture:e,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,updateTrigger:l,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):a?w.jsx(tl,{textureUrl:a,mode:t,action:n,fbxUrl:r,visibleParts:o,showOverlay:i,showEdges:s,printMode:h,onPaint:m,onHover:u,onHoverEnd:d}):null}function tl({textureUrl:a,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o=!0,showEdges:i=!1,printMode:l=!1,onPaint:s,onHover:h,onHoverEnd:m}){const u=mn(a);return w.jsx(Vo,{texture:u,mode:e,action:t,fbxUrl:n,visibleParts:r,showOverlay:o,showEdges:i,printMode:l,onPaint:s,onHover:h,onHoverEnd:m})}function Vo({texture:a,mode:e="voxel",action:t="idle",fbxUrl:n,visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onHover:m,onHoverEnd:u}){const d=e==="cute",z=I.useRef(null),b=I.useRef({}),y=p=>T=>{T&&(b.current[p]=T)},M=I.useRef(!1);I.useEffect(()=>{const p=()=>{M.current=!1};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[]);const S=(p,T,Q=!1)=>{const V=o?Q:!1;if(T.object?.userData?.cell&&V){const Ve=T.object.userData.cell,Ot=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,Ut=["left","right","top","bottom","front","back"][Ot],dt=Ve[`${Ut}_u`],Bt=Ve[`${Ut}_v`];if(dt!==void 0&&Bt!==void 0)return[dt,Bt]}const Z=T.face&&typeof T.face.materialIndex=="number"?T.face.materialIndex:T.face?Math.floor(T.faceIndex/2):0,te=["left","right","top","bottom","front","back"][Z],oe=F.uvMaps[p];if(!oe)return null;let ie=oe[te];if(!ie)return null;if(V){const Ve={};Ve[te]=ie,p==="head"?ie=ye(Ve,32,0)[te]:p==="body"?ie=ye(Ve,0,16)[te]:p.includes("Arm")?ie=ye(Ve,p.includes("left")?16:0,p.includes("left")?0:16)[te]:p.includes("Leg")&&(ie=ye(Ve,p.includes("left")?-16:0,p.includes("left")?0:16)[te])}const[_e,De,ue,Re,Fe,_t]=ie,tt=T.uv;if(!tt)return null;let yt=tt.x,At=tt.y;return Fe&&(yt=1-yt),_t&&(At=1-At),[Math.floor(_e+yt*ue),Math.floor(De+(1-At)*Re)]},g=(p,T,Q=!1,V=!1)=>{const Z=p.replace("Low","");if(r[Z]===!1||Q&&!o||!Q&&o)return;if(T.buttons===0&&m){T.stopPropagation();const te=S(p,T,Q);te&&m(te[0],te[1]);return}if(!h||T.buttons!==1)return;if(T.stopPropagation(),V)M.current=!0;else if(!M.current)return;const K=S(p,T,Q);K&&h(K[0],K[1])};jt(({clock:p})=>{const T=p.getElapsedTime()*10,Q=.2,V=b.current,Z=(K,te,oe,ie=0)=>{V[K]&&V[K].rotation.set(te,oe,ie)};if(t==="idle"){if(d){const K=Math.sin(T*.25)*.1,te=H?Math.sin(T*.15)*.025:0;Z("left_arm",.05,0,Q),Z("right_arm",.05,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,H?.04:0,0),Z("right_leg",0,H?-.04:0,0),Z("head",0,0,te),Z("body",0,0,0),V.body&&V.body.position.set(0,R.bodyPosY+K,0)}else Z("left_arm",0,0,0),Z("right_arm",0,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",0,0,0),Z("right_leg",0,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0);z.current&&(z.current.position.set(0,0,0),z.current.rotation.set(0,0,0))}else if(t==="walk"||t==="walking"){if(d){const K=Math.sin(T*.5)*.5,te=Math.sin(T*.5)*(H?.06:.03),oe=Math.abs(Math.sin(T*.5))*.2;Z("left_arm",-K,0,Q),Z("right_arm",K,0,-Q),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,H?.04:0,0),Z("right_leg",-K,H?-.04:0,0),Z("head",0,0,-te*.5),Z("body",0,0,te),V.body&&V.body.position.set(0,R.bodyPosY+oe,0)}else{const K=Math.sin(T*.5)*.8;Z("left_arm",-K,0,0),Z("right_arm",K,0,0),Z("left_low_arm",0,0,0),Z("right_low_arm",0,0,0),Z("left_leg",K,0,0),Z("right_leg",-K,0,0),Z("head",0,0,0),Z("body",0,0,0),V.body&&V.body.position.set(0,10,0)}z.current&&(z.current.position.y=0,z.current.rotation.x=0)}});const{isAlex:H,processedTexture:E}=I.useMemo(()=>{a.magFilter=Je,a.minFilter=Je,a.colorSpace=Yt,a.needsUpdate=!0;let p=!0;return a.image&&(p=an(a.image)),{isAlex:p,processedTexture:a}},[a,i]),C=I.useMemo(()=>({armWidth:H?3:4,armUVWidth:H?3:4,armPositionX:H?5.5:6}),[H]),v=I.useMemo(()=>{const{armUVWidth:p}=C,T={right:[0,8,8,8],left:[16,8,8,8],top:[8,0,8,8],bottom:[16,0,8,8,0,1],front:[8,8,8,8],back:[24,8,8,8]},Q={right:[16,20,4,12],left:[28,20,4,12],top:[20,16,8,4],bottom:[28,16,8,4,0,1],front:[20,20,8,12],back:[32,20,8,12]},V={right:[40,20,4,6],front:[44,20,p,6],left:[44+p,20,4,6],top:[44,16,p,4],back:[48+p,20,p,6]},Z={right:[40,26,4,6],front:[44,26,p,6],left:[44+p,26,4,6],bottom:[44+p,16,p,4,0,1],back:[48+p,26,p,6]},K=ye(V,-8,32),te=ye(Z,-8,32),oe={right:[0,20,4,6],left:[8,20,4,6],top:[4,16,4,4],front:[4,20,4,6],back:[12,20,4,6]},ie={right:[0,26,4,6],left:[8,26,4,6],bottom:[8,16,4,4,0,1],front:[4,26,4,6],back:[12,26,4,6]},_e=ye(oe,16,32),De=ye(ie,16,32);return{head:T,body:Q,rightArm:V,rightArmLow:Z,leftArm:K,leftArmLow:te,rightLeg:oe,rightLegLow:ie,leftLeg:_e,leftLegLow:De}},[C]),A=I.useMemo(()=>{const p=E.image;if(!p||!p.complete||p.width<=0)return null;const T=document.createElement("canvas");T.width=p.width,T.height=p.height;const Q=T.getContext("2d");return Q?(Q.drawImage(p,0,0),Zs(T),Q.getImageData(0,0,T.width,T.height)):null},[E,i]),_=I.useMemo(()=>{const p=(K,te)=>d&&A?Js(A,E,64,K,te):No(E,64,K,te),T=Sr(A,v.leftArm,v.leftArmLow),Q=Sr(A,v.rightArm,v.rightArmLow),V=Sr(A,v.leftLeg,v.leftLegLow),Z=Sr(A,v.rightLeg,v.rightLegLow);return{head:p(v.head),body:p(v.body),leftArm:p(v.leftArm,{bottom:T}),leftArmLow:p(v.leftArmLow,{top:T}),rightArm:p(v.rightArm,{bottom:Q}),rightArmLow:p(v.rightArmLow,{top:Q}),leftLeg:p(v.leftLeg,{bottom:V}),leftLegLow:p(v.leftLegLow,{top:V}),rightLeg:p(v.rightLeg,{bottom:Z}),rightLegLow:p(v.rightLegLow,{top:Z}),headOverlay:p(ye(v.head,32,0)),bodyOverlay:p(ye(v.body,0,16)),leftArmOverlay:p(ye(v.leftArm,16,0)),leftArmLowOverlay:p(ye(v.leftArmLow,16,0)),rightArmOverlay:p(ye(v.rightArm,0,16)),rightArmLowOverlay:p(ye(v.rightArmLow,0,16)),leftLegOverlay:p(ye(v.leftLeg,-16,0)),leftLegLowOverlay:p(ye(v.leftLegLow,-16,0)),rightLegOverlay:p(ye(v.rightLeg,0,16)),rightLegLowOverlay:p(ye(v.rightLegLow,0,16))}},[E,A,v,d]),D=I.useMemo(()=>{if(e!=="voxel"&&e!=="cute")return null;const{armWidth:p}=C,T=lt(A,[ye(v.body,0,16),.5,[8,d?8:12,4]],l,s,d);d&&T&&T.children.forEach(V=>{if(V instanceof Ft&&V.position){const K=1-.3*Math.max(0,Math.min(1,(V.position.y+4)/8));V.position.x*=K,V.scale.x*=K}else if(V instanceof no&&V.geometry?.attributes?.position){const Z=V.geometry.attributes.position;for(let K=0;K{const p=d?8:12,T=d?new Dt(8,p,4,8,p,4):new Dt(8,p,4);if(d){const Q=T.attributes.position;for(let V=0;V{const p=d?8.5:12.5,T=d?new Dt(8.5,p,4.5,8,d?8:12,4):new Dt(8.5,p,4.5);if(d){const Q=T.attributes.position;for(let V=0;V{const p=(Z,K,te)=>{const oe=new Dt(Z,K,te),ie=new _n(oe);return oe.dispose(),ie},T=()=>{const Z=d?8:12,K=new Dt(8,Z,4);if(d){const oe=K.attributes.position;for(let ie=0;ie()=>{j.dispose(),q.dispose(),B&&Object.values(B).forEach(p=>p.dispose())},[j,q,B]);const F=I.useMemo(()=>({armWidth:C.armWidth,armPositionX:C.armPositionX,uvMaps:v,mats:_,voxels:D}),[C,v,_,D]);I.useEffect(()=>()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&T.map.dispose(),T.dispose()})}),D&&Object.values(D).forEach(p=>{p.traverse(T=>{T.isMesh?(T.geometry.dispose(),Array.isArray(T.material)?T.material.forEach(Q=>{Q.map&&Q.map.dispose(),Q.dispose()}):(T.material.map&&T.material.map.dispose(),T.material.dispose())):T.type==="LineSegments"&&(T.geometry.dispose(),T.material&&T.material.dispose())})})},[_,D]),I.useEffect(()=>{_&&Object.values(_).forEach(p=>{p.forEach(T=>{T.map&&(T.map.needsUpdate=!0)})})},[i,_]);const R=I.useMemo(()=>{if(!d)return{bodyPosY:10,bodyScale:[1,1,1],headPosY:6,headScale:[1,1,1],armScale:[1,1,1],legScale:[1,1,1],shoulderPosY:6,shoulderPosX:C.armPositionX,hipPosY:-6,hipPosX:2};const p=.85;return{bodyPosY:8.5,bodyScale:[p,p,1],headPosY:3.4,headScale:[1,1,1],armScale:[p,p,1],legScale:[p,p,1],shoulderPosY:3.4,shoulderPosX:3.3+(C.armWidth-3)*p/2,hipPosY:-3.4,hipPosX:1.7}},[d,C.armPositionX,C.armWidth]);return w.jsxs("group",{ref:z,onPointerLeave:()=>u?.(),children:[w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ks,{action:t,partsRefs:b,fbxUrl:n})}),w.jsxs("group",{ref:y("body"),position:[0,R.bodyPosY,0],children:[w.jsxs("group",{visible:r.body!==!1,scale:R.bodyScale,children:[w.jsx("mesh",{geometry:j,material:F.mats.body,onPointerDown:p=>g("body",p,!1,!0),onPointerMove:p=>g("body",p),children:l&&w.jsx("lineSegments",{geometry:B.body,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.body,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)}):w.jsx("mesh",{geometry:q,material:F.mats.bodyOverlay,visible:o,onPointerDown:p=>g("body",p,!0,!0),onPointerMove:p=>g("body",p,!0)})]}),w.jsx("group",{ref:y("head"),position:[0,R.headPosY,0],scale:R.headScale,visible:r.head!==!1,children:w.jsxs("group",{position:[0,4,0],children:[w.jsxs("mesh",{material:F.mats.head,onPointerDown:p=>g("head",p,!1,!0),onPointerMove:p=>g("head",p),children:[w.jsx("boxGeometry",{args:[8,8,8]}),l&&w.jsx("lineSegments",{geometry:B.head,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.head,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0)}):w.jsx("mesh",{material:F.mats.headOverlay,visible:o,onPointerDown:p=>g("head",p,!0,!0),onPointerMove:p=>g("head",p,!0),children:w.jsx("boxGeometry",{args:[9,9,9]})})]})}),w.jsxs("group",{ref:y("left_arm"),position:[R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.leftArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftArm,onPointerDown:p=>g("leftArm",p,!1,!0),onPointerMove:p=>g("leftArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArm,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmOverlay,visible:o,onPointerDown:p=>g("leftArm",p,!0,!0),onPointerMove:p=>g("leftArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftArmLow,onPointerDown:p=>g("leftArmLow",p,!1,!0),onPointerMove:p=>g("leftArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftArmLow,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftArmLowOverlay,visible:o,onPointerDown:p=>g("leftArmLow",p,!0,!0),onPointerMove:p=>g("leftArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_arm"),position:[-R.shoulderPosX,R.shoulderPosY,0],scale:R.armScale,visible:r.rightArm!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightArm,onPointerDown:p=>g("rightArm",p,!1,!0),onPointerMove:p=>g("rightArm",p),children:[w.jsx("boxGeometry",{args:[F.armWidth,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.arm,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArm,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmOverlay,visible:o,onPointerDown:p=>g("rightArm",p,!0,!0),onPointerMove:p=>g("rightArm",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_arm"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightArmLow,onPointerDown:p=>g("rightArmLow",p,!1,!0),onPointerMove:p=>g("rightArmLow",p),children:[w.jsx("boxGeometry",{args:[F.armWidth+.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.armLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightArmLow,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightArmLowOverlay,visible:o,onPointerDown:p=>g("rightArmLow",p,!0,!0),onPointerMove:p=>g("rightArmLow",p,!0),children:w.jsx("boxGeometry",{args:[F.armWidth+.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("left_leg"),position:[R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.leftLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.leftLeg,onPointerDown:p=>g("leftLeg",p,!1,!0),onPointerMove:p=>g("leftLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLeg,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegOverlay,visible:o,onPointerDown:p=>g("leftLeg",p,!0,!0),onPointerMove:p=>g("leftLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("left_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.leftLegLow,onPointerDown:p=>g("leftLegLow",p,!1,!0),onPointerMove:p=>g("leftLegLow",p),children:[w.jsx("boxGeometry",{args:[4.002,d?4:6,4.002]}),l&&w.jsx("lineSegments",{geometry:B.legLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.leftLegLow,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.leftLegLowOverlay,visible:o,onPointerDown:p=>g("leftLegLow",p,!0,!0),onPointerMove:p=>g("leftLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]}),w.jsxs("group",{ref:y("right_leg"),position:[-R.hipPosX,R.hipPosY,0],scale:R.legScale,visible:r.rightLeg!==!1,children:[w.jsxs("group",{position:[0,d?-2:-3,0],children:[w.jsxs("mesh",{material:F.mats.rightLeg,onPointerDown:p=>g("rightLeg",p,!1,!0),onPointerMove:p=>g("rightLeg",p),children:[w.jsx("boxGeometry",{args:[4,d?4:6,4]}),l&&w.jsx("lineSegments",{geometry:B.leg,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLeg,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegOverlay,visible:o,onPointerDown:p=>g("rightLeg",p,!0,!0),onPointerMove:p=>g("rightLeg",p,!0),children:w.jsx("boxGeometry",{args:[4.5,(d?4:6)+.5,4.5]})})]}),w.jsx("group",{ref:y("right_low_leg"),position:[0,d?-4:-6,0],children:w.jsxs("group",{position:[0,d?-1.95:-2.95,0],children:[w.jsxs("mesh",{material:F.mats.rightLegLow,onPointerDown:p=>g("rightLegLow",p,!1,!0),onPointerMove:p=>g("rightLegLow",p),children:[w.jsx("boxGeometry",{args:[4.003,d?4:6,4.003]}),l&&w.jsx("lineSegments",{geometry:B.rightLegLow,children:w.jsx("lineBasicMaterial",{color:"white",polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})})]}),e==="voxel"||e==="cute"?w.jsx("primitive",{object:F.voxels.rightLegLow,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0)}):w.jsx("mesh",{material:F.mats.rightLegLowOverlay,visible:o,onPointerDown:p=>g("rightLegLow",p,!0,!0),onPointerMove:p=>g("rightLegLow",p,!0),children:w.jsx("boxGeometry",{args:[4.502,(d?4:6)+.502,4.502]})})]})})]})]})]})}function rl({textureUrl:a,texture:e,mode:t="voxel",action:n="idle",visibleParts:r={},showOverlay:o=!0,updateTrigger:i=0,showEdges:l=!1,printMode:s=!1,onPaint:h,onPaintEnd:m,onHover:u,onHoverEnd:d,flatLighting:z=!1}){const b=I.useRef(!1),y=I.useRef(null);return I.useEffect(()=>{const M=()=>{b.current&&(y.current&&(y.current.enabled=!0),b.current=!1,m?.())};return window.addEventListener("mouseup",M),()=>window.removeEventListener("mouseup",M)},[m]),w.jsxs(za,{camera:{position:[25,25,25],fov:50},shadows:!z,flat:z,children:[!z&&w.jsxs(w.Fragment,{children:[w.jsx("ambientLight",{intensity:.5}),w.jsx("pointLight",{position:[10,10,10]})]}),w.jsx(I.Suspense,{fallback:null,children:w.jsx(Ws,{environment:null,intensity:z?0:.6,shadows:z?!1:{type:"contact",opacity:.6,blur:1.5,frames:1/0},adjustCamera:!1,children:w.jsx(el,{textureUrl:a,texture:e,mode:t,action:n,visibleParts:r,showOverlay:o,updateTrigger:i,showEdges:l,printMode:s,onPaint:h?(M,S)=>{b.current||(b.current=!0,y.current&&(y.current.enabled=!1)),h?.(M,S)}:void 0,onHover:u,onHoverEnd:d})},`${t}`)}),w.jsxs("mesh",{onPointerMove:()=>d?.(),children:[w.jsx("sphereGeometry",{args:[200,32,32]}),w.jsx("meshBasicMaterial",{side:Sa,transparent:!0,opacity:0,depthWrite:!1})]}),w.jsx(Ia,{ref:y,makeDefault:!0,target:[0,0,0]})]})}uo(Ci);const me={fontClass:"",edit:{importTitle:"导入模型文件",importDesc:"导入一张带有皮肤材质的PNG图片(64x64),开启您的创作。",overlay:"外套 (Overlay)",pencil:"铅笔",eraser:"橡皮擦",colorPicker:"取色",undo:"撤销",redo:"重做",import:"导入",export:"下载",invalidDimensions:"尺寸不正确,必须为 64x64",slimMode:"纤细型",strongMode:"标准型",hue:"色相",saturation:"饱和度",brightness:"亮度",contrast:"对比度",adjust:"调整",kmeans:"K-Means 减色",kmeansClusters:"目标颜色数 (K)",kmeansDescription:"通过聚类算法合并相似颜色,使皮肤色彩更干净、像素化更纯粹。",kmeansPalettePreview:"调色盘预览"}};function Wn(a,e){return a>=32&&a<64&&e>=0&&e<16||e>=32&&e<48&&(a>=0&&a<16||a>=16&&a<40||a>=40&&a<56)||e>=48&&e<64&&(a>=0&&a<16||a>=48&&a<64)}function nl(a,e){const t=a.data,n=a.width,r=a.height,o=new Map;for(let b=0;b0){const H=`${y},${M},${S}`;o.has(H)||o.set(H,[]),o.get(H).push(b)}}const i=[];if(o.forEach((b,y)=>{const[M,S,g]=y.split(",").map(Number);i.push({r:M,g:S,b:g,weight:b.length,indices:b})}),i.length<=e){const b=i.map(y=>{const M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");return`#${M}${S}${g}`});return{imageData:a,palette:b}}let l=[];const s=i.length/e;for(let b=0;b0&&(l[E]={r:Math.round(M[E]/H[E]),g:Math.round(S[E]/H[E]),b:Math.round(g[E]/H[E])})}const u=new ImageData(new Uint8ClampedArray(t),n,r),d=new Set;for(let b=0;b{const y=l[b],M=y.r.toString(16).padStart(2,"0"),S=y.g.toString(16).padStart(2,"0"),g=y.b.toString(16).padStart(2,"0");z.push(`#${M}${S}${g}`)}),{imageData:u,palette:z}}function lr(a){const e=a.data,t=new Set;for(let n=0;n0){const r=e[n].toString(16).padStart(2,"0"),o=e[n+1].toString(16).padStart(2,"0"),i=e[n+2].toString(16).padStart(2,"0");t.add(`#${r}${o}${i}`)}return Array.from(t)}function il({textureUrl:a,onSubmit:e,busy:t,onError:n}){const r=n,o=I.useRef(null),[i,l]=I.useState(null),[s,h]=I.useState(null),[m,u]=I.useState(0),[d,z]=I.useState({list:[],index:-1}),b=I.useRef(!1),y=I.useRef(null),[M,S]=I.useState("steve"),[g,H]=I.useState("#ff0000"),[E,C]=I.useState(!a),[v,A]=I.useState("pencil"),[_,D]=I.useState([]),j="plane",[q]=I.useState("idle"),[B,F]=I.useState({head:!0,body:!0,leftArm:!0,rightArm:!0,leftLeg:!0,rightLeg:!0}),[R,p]=I.useState(!0),[T,Q]=I.useState(!1),[V,Z]=I.useState({h:0,s:0,b:0,c:0}),K=I.useRef(null),te=I.useRef({h:0,s:0,b:0,c:0}),oe=()=>{i&&(K.current=i.getImageData(0,0,64,64),te.current={...V})},ie=(O,Y,ae,He)=>{if(!i||!K.current)return;const ne=K.current,de=new ImageData(new Uint8ClampedArray(ne.data),64,64),pe=O-te.current.h,rt=Y-te.current.s,Ge=ae-te.current.b,Te=He-te.current.c,ve=259*(Te+255)/(255*(259-Te));for(let je=0;je.5?Ze/(2-bt-Ht):Ze/(bt+Ht),bt){case nt:Lt=(wt-xt)/Ze+(wt(L<0&&(L+=1),L>1&&(L-=1),L<.16666666666666666?f+(x-f)*6*L:L<.5?x:L<.6666666666666666?f+(x-f)*(.6666666666666666-L)*6:f),Wt=Mt<.5?Mt*(1+Gt):Mt+Gt-Mt*Gt,c=2*Mt-Wt;tr=Ze(c,Wt,Tt+1/3),zt=Ze(c,Wt,Tt),rr=Ze(c,Wt,Tt-1/3)}let mt=(tr-.5)*ve+.5,pt=(zt-.5)*ve+.5,le=(rr-.5)*ve+.5;mt=Math.max(0,Math.min(1,mt)),pt=Math.max(0,Math.min(1,pt)),le=Math.max(0,Math.min(1,le)),de.data[je]=Math.round(mt*255),de.data[je+1]=Math.round(pt*255),de.data[je+2]=Math.round(le*255)}i.putImageData(de,0,0),s&&(s.needsUpdate=!0,u(je=>je+1))},_e=(O,Y)=>{const ae={...V,[O]:Y};Z(ae),ie(ae.h,ae.s,ae.b,ae.c)},De=()=>{dt(V),K.current=null},[ue,Re]=I.useState(16),[Fe,_t]=I.useState([]),tt=I.useRef(null),yt=()=>{i&&(tt.current=i.getImageData(0,0,64,64))},At=O=>{if(!i||!tt.current)return;const Y=nl(tt.current,O);i.putImageData(Y.imageData,0,0),_t(Y.palette),s&&(s.needsUpdate=!0,u(ae=>ae+1))},Ve=O=>{Re(O),At(O)},Ot=()=>{dt(),tt.current=null};I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y);const ae=Math.min(48,Math.max(2,Y.length));Re(ae)}},[T,i]),I.useEffect(()=>{if(T&&i){const O=i.getImageData(0,0,64,64),Y=lr(O);_t(Y)}},[m]);const it=O=>{F(Y=>({...Y,[O]:!Y[O]}))};I.useEffect(()=>{const O=o.current;if(!O)return;O.width=64,O.height=64;const Y=O.getContext("2d",{willReadFrequently:!0});if(!Y)return;if(!a){Y.clearRect(0,0,64,64),l(Y),C(!0),S("steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne);return}const ae=new Image;return ae.crossOrigin="anonymous",ae.onerror=()=>n("皮肤加载失败,请关闭后重试"),ae.onload=()=>{if(ae.width!==64||![32,64].includes(ae.height)){n("皮肤尺寸必须为 64×64 或 64×32");return}C(!1),Y.clearRect(0,0,64,64),ae.width===64&&ae.height===32?(Y.drawImage(ae,0,0),Y.drawImage(O,40,16,16,16,32,48,16,16),Y.drawImage(O,0,16,16,16,16,48,16,16)):Y.drawImage(ae,0,0,64,64),l(Y),S(an(ae)?"alex":"steve");const He=Y.getImageData(0,0,64,64);z({list:[{data:He,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(He).length))}],index:0});const ne=new Vr(O);ne.magFilter=Je,ne.minFilter=Je,ne.colorSpace=Yt,h(ne)},ae.src=a,()=>{ae.onload=null,ae.onerror=null}},[a]);const Ut=(O,Y)=>{if(i&&O>=0&&O<64&&Y>=0&&Y<64){i.imageSmoothingEnabled=!1,y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae&&v!=="picker"||!R&&ae&&v!=="picker")return;if(v==="picker"){let ne=i.getImageData(O,Y,1,1).data;if(ne[3]===0){let de=O,pe=Y;O>=32&&O<64&&Y>=0&&Y<16?de=O-32:Y>=32&&Y<48?(O>=0&&O<16||O>=16&&O<40||O>=40&&O<56)&&(pe=Y-16):Y>=48&&Y<64&&(O>=0&&O<16?de=O+16:O>=48&&O<64&&(de=O-16)),(de!==O||pe!==Y)&&(ne=i.getImageData(de,pe,1,1).data)}if(ne[3]===0)A("eraser");else{const de=ne[0].toString(16).padStart(2,"0"),pe=ne[1].toString(16).padStart(2,"0"),rt=ne[2].toString(16).padStart(2,"0"),Ge=`#${de}${pe}${rt}`;H(Ge),A("pencil")}return}let He=!1;if(v==="pencil")i.fillStyle=g,i.fillRect(O,Y,1,1),He=!0,D(ne=>{if(ne[0]?.toLowerCase()===g.toLowerCase())return ne;const de=ne.filter(pe=>pe.toLowerCase()!==g.toLowerCase());return[g,...de].slice(0,10)});else if(v==="eraser")if(ae)i.clearRect(O,Y,1,1),He=!0;else return;He&&(b.current=!0,C(!1),s&&(s.needsUpdate=!0,u(ne=>ne+1)))}},dt=(O={h:0,s:0,b:0,c:0},Y=ue)=>{if(!i||!o.current)return;const He=i.getImageData(0,0,64,64);z(ne=>{const de=ne.list.slice(0,ne.index+1);return de.push({data:He,hsb:{...O},kmeansK:Y}),de.length>50&&de.shift(),{list:de,index:de.length-1}})},Bt=()=>{d.index<=0||wr(d.index-1)},Rr=()=>{d.index>=d.list.length-1||wr(d.index+1)},wr=O=>{if(!i||O<0||O>=d.list.length)return;const Y=d.list[O];i.putImageData(Y.data,0,0),z(ae=>({...ae,index:O})),Z({...Y.hsb}),K.current=null,Y.kmeansK!==void 0&&Re(Y.kmeansK),tt.current=null,s&&(s.needsUpdate=!0,u(ae=>ae+1))},Fr=()=>{b.current&&(dt(),b.current=!1)},jr=(O,Y)=>{if(!i||v==="picker"||O<0||O>=64||Y<0||Y>=64||y.current&&y.current.x===O&&y.current.y===Y)return;y.current&&(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null);const ae=Wn(O,Y);if(R&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(!R&&ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}if(v==="eraser"&&!ae){s&&(s.needsUpdate=!0,u(ne=>ne+1));return}const He=i.getImageData(O,Y,1,1);y.current={x:O,y:Y,savedData:He},v==="pencil"?(i.fillStyle=g,i.fillRect(O,Y,1,1)):v==="eraser"&&i.clearRect(O,Y,1,1),s&&(s.needsUpdate=!0,u(ne=>ne+1))},Nt=()=>{!i||!y.current||(i.putImageData(y.current.savedData,y.current.x,y.current.y),y.current=null,s&&(s.needsUpdate=!0,u(O=>O+1)))},Or=O=>{const Y=O.target.files?.[0];if(!Y)return;const ae=new FileReader;ae.onload=He=>{const ne=new Image;ne.onload=()=>{if(!(ne.width===64&&(ne.height===64||ne.height===32))){r(me.edit.invalidDimensions);return}if(!i)return;const pe=document.createElement("canvas"),rt=pe.getContext("2d");if(!rt)return;if(pe.width=ne.width,pe.height=ne.height,rt.drawImage(ne,0,0),i.clearRect(0,0,64,64),ne.width===64&&ne.height===32){i.drawImage(ne,0,0);const ve=rt.getImageData(40,16,16,16);i.putImageData(ve,32,48);const je=rt.getImageData(0,16,16,16);i.putImageData(je,16,48)}else i.drawImage(ne,0,0,64,64);s&&s.dispose();const Ge=o.current;if(Ge){const ve=new Vr(Ge);ve.magFilter=Je,ve.minFilter=Je,ve.colorSpace=Yt,h(ve)}u(ve=>ve+1),C(!1),S(an(ne)?"alex":"steve");const Te=i.getImageData(0,0,64,64);z({list:[{data:Te,hsb:{h:0,s:0,b:0,c:0},kmeansK:Math.min(48,Math.max(2,lr(Te).length))}],index:0}),O.target.value=""},ne.src=He.target?.result},ae.readAsDataURL(Y)},Vt=O=>{if(!i||M===O)return;const Y=o.current;Y&&(Ys(Y,O),S(O),s&&(s.needsUpdate=!0,u(ae=>ae+1)),dt())},Ur=()=>{const O=o.current;if(!O)return;const Y=document.createElement("a");Y.download="skin_edited.png",Y.href=O.toDataURL(),Y.click()},Br=["#FF595E","#FF9F1C","#FFCA3A","#8AC926","#1982C4","#6A4C93","#F3D5C0","#DDBEA9","#CB997E","#A5A58D","#6B705C","#34251F","#FFFFFF","#D1D5DB","#6B7280","#4B5563","#1F2937"];return I.useEffect(()=>()=>s?.dispose(),[s]),w.jsxs("div",{className:"editor-surface flex flex-col h-full",style:{pointerEvents:t?"none":"auto"},children:[w.jsx("button",{className:"editor-submit",disabled:t||!i||!s,onClick:()=>{Nt(),e(o.current.toDataURL("image/png"))},children:t?"保存中…":"提交并选为最佳(完美)"}),w.jsxs("div",{className:"flex-1 flex min-h-0",children:[w.jsx("div",{className:"w-full flex-1 bg-black/30 border border-white/5 flex flex-col items-center justify-center relative overflow-hidden min-w-0",children:w.jsxs("div",{className:`w-full h-full bg-[#1a1a1a] overflow-hidden flex items-center justify-center shadow-inner relative ${v==="picker"?"cursor-crosshair":""}`,onPointerLeave:Nt,children:[w.jsx("input",{id:"import-input",type:"file",accept:"image/*",style:{display:"none"},onChange:Or}),E?w.jsxs("div",{className:"flex flex-col items-center gap-4 z-20",children:[w.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-[#3c8527] hover:bg-[#4ea632] text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:search",className:"text-base"}),"发现皮肤"]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:"px-6 py-3 bg-zinc-800 hover:bg-zinc-700 text-white font-pixel-hans text-xs cursor-pointer flex items-center gap-2 transition-all shadow-lg border border-black active:translate-y-px",children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-base"}),me.edit.importTitle]})]}),w.jsx("div",{className:"text-white/40 font-pixel-hans text-[11px] text-center max-w-xs mt-2 leading-relaxed",children:me.edit.importDesc})]}):null,!E&&s&&w.jsxs(w.Fragment,{children:[w.jsx(rl,{texture:s,updateTrigger:m,mode:j,action:q,visibleParts:B,showOverlay:R,onPaint:Ut,onPaintEnd:Fr,onHover:jr,onHoverEnd:Nt,flatLighting:!0}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-start gap-1.5 pointer-events-auto lg:left-4 lg:top-1/2 lg:-translate-y-1/2 max-lg:bottom-20 max-lg:left-4",children:[w.jsxs("button",{onClick:()=>p(!R),className:`p-1.5 px-2 bg-black/60 backdrop-blur-md border text-white cursor-pointer hover:bg-black/80 flex items-center gap-1.5 transition-all outline-none ${me.fontClass} ${R?"border-[#4ea632]/80 bg-[#4ea632]/10":"border-white/10"}`,children:[w.jsx("div",{className:`w-4 h-4 border flex items-center justify-center transition-all duration-200 ${R?"border-white bg-[#4ea632]":"border-white/20 bg-transparent"}`,children:w.jsx(qe,{icon:"pixelarticons:check",className:`text-xs text-white animate-in zoom-in duration-100 ${R?"block":"hidden"}`})}),w.jsx("span",{className:`text-xs ${R?"text-white":"text-white/60"}`,children:me.edit.overlay})]}),w.jsxs("div",{className:"flex flex-col gap-2 bg-black/60 backdrop-blur-md p-2 border border-white/10",children:[w.jsx("button",{onClick:()=>A("pencil"),className:`p-2 border cursor-pointer ${v==="pencil"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.pencil,children:w.jsx(qe,{icon:"pixelarticons:edit",className:"text-base"})}),w.jsx("button",{onClick:()=>A("eraser"),className:`p-2 border cursor-pointer ${v==="eraser"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.eraser,children:w.jsx(qe,{icon:"pixelarticons:eraser",className:"text-base"})}),w.jsx("button",{onClick:()=>A("picker"),className:`p-2 border cursor-pointer ${v==="picker"?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.colorPicker,children:w.jsx(qe,{icon:"pixelarticons:pipette",className:"text-base"})}),w.jsx("div",{className:"w-full h-px bg-white/5 my-1"}),w.jsx("button",{onClick:()=>Q(!T),className:`p-2 border cursor-pointer ${T?"bg-[#3c8527] border-black text-white":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,title:me.edit.adjust,children:w.jsx(qe,{icon:"pixelarticons:sliders",className:"text-base"})})]}),T&&w.jsxs("div",{className:"absolute left-16 top-0 z-30 bg-black/90 backdrop-blur-lg p-4 border border-white/10 flex flex-col gap-4 min-w-[240px] max-w-[300px] shadow-2xl animate-in slide-in-from-left-4 fade-in duration-300 pointer-events-auto",children:[w.jsxs("div",{className:"flex justify-between items-center mb-1",children:[w.jsx("span",{className:`text-[10px] text-white/40 uppercase tracking-widest ${me.fontClass}`,children:me.edit.adjust}),w.jsx("button",{onClick:()=>Q(!1),className:"text-white/30 hover:text-white transition-colors cursor-pointer",children:w.jsx(qe,{icon:"pixelarticons:close",className:"text-sm"})})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:[me.edit.adjust," (HSB)"]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.hue}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.h,"°"]})]}),w.jsx("input",{type:"range",min:"-180",max:"180",value:V.h,onPointerDown:oe,onChange:O=>_e("h",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.saturation}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.s>0?"+":"",V.s,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.s,onPointerDown:oe,onChange:O=>_e("s",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.brightness}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.b>0?"+":"",V.b,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.b,onPointerDown:oe,onChange:O=>_e("b",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.contrast}),w.jsxs("span",{className:"text-[#4ea632]",children:[V.c>0?"+":"",V.c,"%"]})]}),w.jsx("input",{type:"range",min:"-100",max:"100",value:V.c,onPointerDown:oe,onChange:O=>_e("c",parseInt(O.target.value)),onPointerUp:De,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]})]}),w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans pb-1 border-b border-white/5",children:me.edit.kmeans}),w.jsx("div",{className:"text-[10px] text-white/50 leading-relaxed font-pixel-hans",children:me.edit.kmeansDescription}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex justify-between text-[11px] font-pixel-hans",children:[w.jsx("span",{className:"text-white/60",children:me.edit.kmeansClusters}),w.jsx("span",{className:"text-[#4ea632] font-bold",children:ue})]}),w.jsx("input",{type:"range",min:"2",max:"48",value:ue,onPointerDown:yt,onChange:O=>Ve(parseInt(O.target.value)),onPointerUp:Ot,className:"w-full h-1.5 bg-white/10 rounded-none appearance-none cursor-pointer accent-[#4ea632]"})]}),Fe.length>0&&w.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[w.jsxs("div",{className:"text-[9px] text-white/40 uppercase tracking-widest font-pixel-hans",children:[me.edit.kmeansPalettePreview," (",Fe.length,")"]}),w.jsx("div",{className:"flex flex-wrap gap-1 p-1 bg-black/20 border border-white/5 max-h-[72px] overflow-y-auto custom-scrollbar",children:Fe.map((O,Y)=>w.jsx("div",{style:{backgroundColor:O},className:"w-4 h-4 border border-black/50 shrink-0 cursor-pointer transform hover:scale-110 transition-transform",onClick:()=>H(O),title:O},Y))})]})]})]})]}),w.jsxs("div",{className:"editor-history-tools absolute top-4 right-4 z-20 flex gap-1.5 bg-black/60 backdrop-blur-md p-1 border border-white/10 items-center",children:[!E&&w.jsxs(w.Fragment,{children:[w.jsx("button",{onClick:Bt,disabled:d.index<=0,className:`p-1.5 border cursor-pointer ${d.index<=0?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.undo,children:w.jsx(qe,{icon:"pixelarticons:undo",className:"text-sm text-white"})}),w.jsx("button",{onClick:Rr,disabled:d.index>=d.list.length-1,className:`p-1.5 border cursor-pointer ${d.index>=d.list.length-1?"opacity-30 cursor-not-allowed":"bg-white/10 border-white/20 text-white hover:bg-white/20"}`,title:me.edit.redo,children:w.jsx(qe,{icon:"pixelarticons:redo",className:"text-sm text-white"})}),w.jsx("div",{className:"w-px h-3 bg-white/10"})]}),w.jsxs("button",{onClick:()=>document.getElementById("import-input")?.click(),className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.import,children:[w.jsx(qe,{icon:"pixelarticons:upload",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.import})]}),!E&&w.jsx(w.Fragment,{children:w.jsxs("button",{onClick:Ur,className:`p-1.5 px-2.5 bg-[#555] hover:bg-[#666] text-white border border-black cursor-pointer flex items-center gap-1.5 transition-colors active:translate-y-px ${me.fontClass}`,title:me.edit.export,children:[w.jsx(qe,{icon:"pixelarticons:download",className:"text-sm"}),w.jsx("span",{className:"text-[11px] font-bold",children:me.edit.export})]})})]}),w.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex flex-row items-center gap-1.5 bg-black/60 backdrop-blur-md p-1.5 border border-white/10 pointer-events-auto w-[92%] max-w-[300px] sm:w-auto sm:max-w-xl shadow-2xl",children:[w.jsxs("div",{className:"relative w-12 h-12 border border-white/20 bg-transparent flex-shrink-0 shadow-lg",children:[w.jsx("input",{type:"color",value:g,onChange:O=>H(O.target.value),className:"absolute inset-0 w-full h-full cursor-pointer opacity-0 z-10"}),w.jsx("div",{className:"absolute inset-0 border border-black/50",style:{backgroundColor:g}})]}),w.jsxs("div",{className:"flex-1 flex flex-row items-center gap-1 p-1 bg-black/20 border border-white/5 overflow-x-auto custom-scrollbar min-w-0",children:[_.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O)),_.length>0&&w.jsx("div",{className:"w-px h-4 bg-white/20 shrink-0 mx-1"}),Br.map(O=>w.jsx("button",{style:{backgroundColor:O},onClick:()=>H(O),className:`w-8 h-8 sm:w-6 sm:h-6 shrink-0 border border-black cursor-pointer transform hover:scale-110 transition-transform ${g===O?"ring-2 ring-white/60":""}`},O))]})]}),w.jsxs("div",{className:"absolute z-20 flex flex-col items-center gap-2 pointer-events-auto lg:bottom-4 lg:right-4 max-lg:bottom-20 max-lg:right-4",children:[w.jsxs("div",{className:"flex bg-black/60 backdrop-blur-md border border-white/10 p-0.5",children:[w.jsx("button",{onClick:()=>Vt("steve"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="steve"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.strongMode}),w.jsx("button",{onClick:()=>Vt("alex"),className:`px-2 py-1 text-[9px] cursor-pointer transition-colors ${me.fontClass} ${M==="alex"?"bg-[#3c8527] text-white":"text-white/40 hover:text-white/60"}`,children:me.edit.slimMode})]}),w.jsxs("div",{className:"bg-black/40 backdrop-blur-md p-4 border border-white/10 flex flex-col items-center gap-1.5 w-fit",children:[w.jsx("div",{onClick:()=>it("head"),className:`w-6 h-6 cursor-pointer border-2 transition-colors ${B.head?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("body"),className:`w-6 h-9 cursor-pointer border-2 transition-colors ${B.body?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftArm"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftArm?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]}),w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("div",{onClick:()=>it("rightLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.rightLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`}),w.jsx("div",{onClick:()=>it("leftLeg"),className:`w-3 h-9 cursor-pointer border-2 transition-colors ${B.leftLeg?"bg-[#4ea632] border-[#4ea632]":"bg-transparent border-white/20"}`})]})]})]})]})]})}),w.jsx("canvas",{ref:o,style:{display:"none"}})]})]})}export{il as SkinEditor}; diff --git a/best_annotator/static/assets/index-1xYycQFu.js b/best_annotator/static/assets/index-1xYycQFu.js new file mode 100644 index 0000000000000000000000000000000000000000..b1f13d646a0112df2c41d773e6ee4b20e5f2b90c --- /dev/null +++ b/best_annotator/static/assets/index-1xYycQFu.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-DLV3L4Lz.js","assets/OrbitControls-DQYijb2B.js","assets/SkinEditor-BsOaSug0.css","assets/MeatEditor-BZS2SjzS.js"])))=>i.map(i=>d[i]); +(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const N of document.querySelectorAll('link[rel="modulepreload"]'))v(N);new MutationObserver(N=>{for(const L of N)if(L.type==="childList")for(const k of L.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&v(k)}).observe(document,{childList:!0,subtree:!0});function j(N){const L={};return N.integrity&&(L.integrity=N.integrity),N.referrerPolicy&&(L.referrerPolicy=N.referrerPolicy),N.crossOrigin==="use-credentials"?L.credentials="include":N.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(N){if(N.ep)return;N.ep=!0;const L=j(N);fetch(N.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(C,j,v){let N=Promise.resolve();if(j&&j.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),nl=k?.nonce||k?.getAttribute("nonce");N=U(j.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const Y=document.createElement("link");if(Y.rel=Q?"stylesheet":ny,Q||(Y.as="script"),Y.crossOrigin="",Y.href=T,nl&&Y.setAttribute("nonce",nl),document.head.appendChild(Y),Q)return new Promise((vl,Al)=>{Y.addEventListener("load",vl),Y.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function L(k){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=k,window.dispatchEvent(nl),!nl.defaultPrevented)throw k}return N.then(k=>{for(const nl of k||[])nl.status==="rejected"&&L(nl.reason);return C().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var zf={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function j(v,N,L){var k=null;if(L!==void 0&&(k=""+L),N.key!==void 0&&(k=""+N.key),"key"in N){L={};for(var nl in N)nl!=="key"&&(L[nl]=N[nl])}else L=N;return N=L.ref,{$$typeof:o,type:v,key:k,ref:N!==void 0?N:null,props:L}}return Gu.Fragment=C,Gu.jsx=j,Gu.jsxs=j,Gu}var Mr;function sy(){return Mr||(Mr=1,zf.exports=fy()),zf.exports}var g=sy(),pf={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),k=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),Y=Symbol.iterator;function vl(d){return d===null||typeof d!="object"?null:(d=Y&&d[Y]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,K={};function bl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}bl.prototype.isReactComponent={},bl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},bl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Gl(){}Gl.prototype=bl.prototype;function Xl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}var Fl=Xl.prototype=new Gl;Fl.constructor=Xl,Nl(Fl,bl.prototype),Fl.isPureReactComponent=!0;var Et=Array.isArray;function Zl(){}var I={H:null,A:null,T:null,S:null},Ul=Object.prototype.hasOwnProperty;function zt(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function et(d,m){return zt(d.type,m,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ml(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function il(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):m.toString(36)}function Il(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var Z=typeof d;(Z==="undefined"||Z==="boolean")&&(d=null);var F=!1;if(d===null)F=!0;else switch(Z){case"bigint":case"string":case"number":F=!0;break;case"object":switch(d.$$typeof){case o:case C:F=!0;break;case Q:return F=d._init,p(F(d._payload),m,O,x,J)}}if(F)return J=J(d),F=x===""?"."+il(d,0):x,Et(J)?(O="",F!=null&&(O=F.replace(pt,"$&/")+"/"),p(J,m,O,"",function(ce){return ce})):J!=null&&(Kl(J)&&(J=et(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+F)),m.push(J)),1;F=0;var Rl=x===""?".":x+":";if(Et(d))for(var El=0;El>>1,ol=p[sl];if(0>>1;slN(O,H))xN(J,O)?(p[sl]=J,p[x]=H,sl=x):(p[sl]=O,p[m]=H,sl=m);else if(xN(J,H))p[sl]=J,p[x]=H,sl=x;else break l}}return M}function N(p,M){var H=p.sortIndex-M.sortIndex;return H!==0?H:p.id-M.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var k=Date,nl=k.now();o.unstable_now=function(){return k.now()-nl}}var U=[],T=[],Q=1,R=null,Y=3,vl=!1,Al=!1,Nl=!1,K=!1,bl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,Xl=typeof setImmediate<"u"?setImmediate:null;function Fl(p){for(var M=j(T);M!==null;){if(M.callback===null)v(T);else if(M.startTime<=p)v(T),M.sortIndex=M.expirationTime,C(U,M);else break;M=j(T)}}function Et(p){if(Nl=!1,Fl(p),!Al)if(j(U)!==null)Al=!0,Zl||(Zl=!0,Ml());else{var M=j(T);M!==null&&Il(Et,M.startTime-p)}}var Zl=!1,I=-1,Ul=5,zt=-1;function et(){return K?!0:!(o.unstable_now()-ztp&&et());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,Y=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,Fl(p),M=!0;break t}R===j(U)&&v(U),Fl(p)}else v(U);R=j(U)}if(R!==null)M=!0;else{var d=j(T);d!==null&&Il(Et,d.startTime-p),M=!1}}break l}finally{R=null,Y=H,vl=!1}M=void 0}}finally{M?Ml():Zl=!1}}}var Ml;if(typeof Xl=="function")Ml=function(){Xl(Kl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,il=pt.port2;pt.port1.onmessage=Kl,Ml=function(){il.postMessage(null)}}else Ml=function(){bl(Kl,0)};function Il(p,M){I=bl(function(){p(o.unstable_now())},M)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=H,C(T,p),j(U)===null&&p===j(T)&&(Nl?(Gl(I),I=-1):Nl=!0,Il(Et,H-sl))):(p.sortIndex=ol,C(U,p),Al||vl||(Al=!0,Zl||(Zl=!0,Ml()))),p},o.unstable_shouldYield=et,o.unstable_wrapCallback=function(p){var M=Y;return function(){var H=Y;Y=M;try{return p.apply(this,arguments)}finally{Y=H}}}})(Af)),Af}var Ur;function ry(){return Ur||(Ur=1,_f.exports=oy()),_f.exports}var Of={exports:{}},lt={};var Cr;function my(){if(Cr)return lt;Cr=1;var o=Mf();function C(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Of.exports=my(),Of.exports}var Rr;function yy(){if(Rr)return Xu;Rr=1;var o=ry(),C=Mf(),j=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),Z=d(null),F=d(null);function Rl(l,t){switch(O(Z,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?ko(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=ko(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function El(){m(x),m(J),m(Z)}function ce(l){l.memoizedState!==null&&O(F,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),F.current===l&&(m(F),xu._currentValue=H)}var la,Va;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==h[u]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=u);break}}}finally{La=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Qu(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ta(l.type,!1);case 11:return ta(l.type.render,!1);case 1:return ta(l.type,!0);case 31:return Zt("Activity");default:return""}}function Bt(l){try{var t="",e=null;do t+=Qu(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var xe=Object.prototype.hasOwnProperty,ea=o.unstable_scheduleCallback,Ka=o.unstable_cancelCallback,ci=o.unstable_shouldYield,b=o.unstable_requestPaint,D=o.unstable_now,tl=o.unstable_getCurrentPriorityLevel,Pl=o.unstable_ImmediatePriority,Ol=o.unstable_UserBlockingPriority,at=o.unstable_NormalPriority,Ja=o.unstable_LowPriority,aa=o.unstable_IdlePriority,fe=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,ot=null;function se(l){if(typeof fe=="function"&&Zr(l),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(wa,l)}catch{}}var rt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Zu=256,Vu=262144,Lu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ku(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function ka(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Lu;return Lu<<=1,(Lu&62914560)===0&&(Lu=4194304),l}function fi(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?yi(l,i,_t(t)):e!=null?yi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){mi(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),mi(l)}function yi(l,t,e){t==="number"&&ku(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function sa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(Kt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{Ei=!1}var oe=null,zi=null,$u=null;function kf(){if($u)return $u;var l,t=zi,e=t.length,a,u="value"in oe?oe.value:oe.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ma=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ma)return l==="compositionend"||!Oi&&es(l,t)?(l=kf(),$u=zi=oe=null,ma=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=ku(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=ku(l.document)}return t}function Di(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Kt&&"documentMode"in document&&11>=document.documentMode,va=null,Ni=null,iu=null,Ui=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ui||va==null||va!==ku(a)||(a=va,"selectionStart"in a&&Di(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Ln(Ni,"onSelect"),0>=i,u-=i,Yt=1<<32-rt(t)+u|e<$?(al=B,B=null):al=B.sibling;var fl=S(r,B,y[$],_);if(fl===null){B===null&&(B=al);break}l&&B&&fl.alternate===null&&t(r,B),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl,B=al}if($===y.length)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;$$?(al=B,B=null):al=B.sibling;var He=S(r,B,fl.value,_);if(He===null){B===null&&(B=al);break}l&&B&&He.alternate===null&&t(r,B),s=n(He,s,$),cl===null?G=He:cl.sibling=He,cl=He,B=al}if(fl.done)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;!fl.done;$++,fl=y.next())fl=A(r,fl.value,_),fl!==null&&(s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return ul&&wt(r,$),G}for(B=a(B);!fl.done;$++,fl=y.next())fl=E(B,r,$,fl.value,_),fl!==null&&(l&&fl.alternate!==null&&B.delete(fl.key===null?$:fl.key),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return l&&B.forEach(function(uy){return t(r,uy)}),ul&&wt(r,$),G}function gl(r,s,y,_){if(typeof y=="object"&&y!==null&&y.type===Nl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case vl:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===Nl){if(s.tag===7){e(r,s.sibling),_=u(s,y.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ul&&we(G)===s.type){e(r,s.sibling),_=u(s,y.props),ru(_,y),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}y.type===Nl?(_=Ze(y.props.children,r.mode,_,y.key),_.return=r,r=_):(_=cn(y.type,y.key,y.props,null,r.mode,_),ru(_,y),_.return=r,r=_)}return i(r);case Al:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(r,s.sibling),_=u(s,y.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Yi(y,r.mode,_),_.return=r,r=_}return i(r);case Ul:return y=we(y),gl(r,s,y,_)}if(Il(y))return q(r,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(r,s,y,_)}if(typeof y.then=="function")return gl(r,s,vn(y),_);if(y.$$typeof===Xl)return gl(r,s,dn(r,y),_);yn(r,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,y),_.return=r,r=_):(e(r,s),_=Bi(y,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,y,_){try{ou=0;var G=gl(r,s,y,_);return Aa=null,G}catch(B){if(B===_a||B===rn)throw B;var cl=vt(29,B,null,r.mode);return cl.lanes=_,cl.return=r,cl}}}var We=Ys(!0),Gs=Ys(!1),he=!1;function $i(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fi(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ge(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Se(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=nn(l),ps(l,null,e),t}return un(l,a,t,e),nn(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Ii(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Pi=!1;function vu(){if(Pi){var l=Ta;if(l!==null)throw l}}function yu(l,t,e,a){Pi=!1;var u=l.updateQueue;he=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var z=l.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=h:c.next=h,z.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,z=h=f=null,c=n;do{var S=c.lane&-536870913,E=S!==c.lane;if(E?(el&S)===S:(a&S)===S){S!==0&&S===pa&&(Pi=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var q=l,X=c;S=t;var gl=e;switch(X.tag){case 1:if(q=X.payload,typeof q=="function"){A=q.call(gl,A,S);break l}A=q;break l;case 3:q.flags=q.flags&-65537|128;case 0:if(q=X.payload,S=typeof q=="function"?q.call(gl,A,S):q,S==null)break l;A=R({},A,S);break l;case 2:he=!0}}S=c.callback,S!==null&&(l.flags|=64,E&&(l.flags|=8192),E=u.callbacks,E===null?u.callbacks=[S]:E.push(S))}else E={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(h=z=E,f=A):z=z.next=E,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;E=c,c=E.next,E.next=null,u.lastBaseUpdate=E,u.shared.pending=null}}while(!0);z===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=z,n===null&&(u.shared.lanes=0),Te|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,Sc(l,!1,t,e);try{var f=u(),h=p.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=wm(f,a);Su(l,t,z,bt(l))}else Su(l,t,a,bt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},bt())}finally{M.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function hc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,H,e===null?Pm:function(){return Ed(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:H},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Ed(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},bt())}function gc(){return kl(xu)}function zd(){return Hl().memoizedState}function pd(){return Hl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=bt();l=ge(e);var a=Se(t,l,e);a!==null&&(dt(a,t,e),mu(a,t,e)),t={cache:Ji()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=bt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},An(l)?_d(t,e):(e=xi(l,t,e,a),e!==null&&(dt(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=bt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(An(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,mt(c,i))return un(l,t,u,0),Sl===null&&an(),!1}catch{}if(e=xi(l,t,u,a),e!==null)return dt(e,l,a),Ad(e,t,a),!0}return!1}function Sc(l,t,e,a){if(a={lane:2,revertLane:$c(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},An(l)){if(t)throw Error(v(479))}else t=xi(l,e,a,2),t!==null&&dt(t,l,2)}function An(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Ma=Sn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:kl,use:zn,useCallback:jl,useContext:jl,useEffect:jl,useImperativeHandle:jl,useLayoutEffect:jl,useInsertionEffect:jl,useMemo:jl,useReducer:jl,useRef:jl,useState:jl,useDebugValue:jl,useDeferredValue:jl,useTransition:jl,useSyncExternalStore:jl,useId:jl,useHostTransitionStatus:jl,useFormState:jl,useActionState:jl,useOptimistic:jl,useMemoCache:jl,useCacheRefresh:jl};bu.useEffectEvent=jl;var Od={readContext:kl,use:zn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:kl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,Tn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return Tn(4194308,4,l,t)},useInsertionEffect:function(l,t){Tn(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){se(!0);try{l()}finally{se(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){se(!0);try{e(t)}finally{se(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=oc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:vc,useDeferredValue:function(l,t){var e=tt();return yc(e,l,t)},useTransition:function(){var l=oc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=tt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),Sl===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Da(9,{destroy:void 0},ks.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=Sl.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-rt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=bn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[ut]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Pt(t)}}return pl(t),Cc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&Pt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=Z.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ve(t,!0)}else l=Kn(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return pl(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),l=!1}else e=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(ht(t),t):(ht(t),null);if((t.flags&128)!==0)throw Error(v(558))}return pl(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),u=!1}else u=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ht(t),t):(ht(t),null)}return ht(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Nn(t,t.updateQueue),pl(t),null);case 4:return El(),l===null&&lf(t.stateNode.containerInfo),pl(t),null;case 10:return Wt(t.type),pl(t),null;case 19:if(m(Cl),a=t.memoizedState,a===null)return pl(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Dl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=gn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Nn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Cl,Cl.current&1|2),ul&&wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&D()>xn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=gn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Nn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return pl(t),null}else 2*D()-a.renderingStartTime>xn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=D(),l.sibling=null,e=Cl.current,O(Cl,u?e&1|2:e&1),ul&&wt(t,a.treeForkCount),l):(pl(t),null);case 22:case 23:return ht(t),tc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),e=t.updateQueue,e!==null&&Nn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),Wt(xl),pl(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Xi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return Wt(xl),El(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(ht(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(ht(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Cl),null;case 4:return El(),null;case 10:return Wt(t.type),null;case 22:case 23:return ht(t),tc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return Wt(xl),null;case 25:return null;default:return null}}function $d(l,t){switch(Xi(t),t.tag){case 3:Wt(xl),El();break;case 26:case 27:case 5:Tt(t);break;case 4:El();break;case 31:t.memoizedState!==null&&ht(t);break;case 13:ht(t);break;case 19:m(Cl);break;case 10:Wt(t.type);break;case 22:case 23:ht(t),tc(),l!==null&&m(Je);break;case 24:Wt(xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){ml(t,t.return,c)}}function ze(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(z){ml(u,f,z)}}}a=a.next}while(a!==n)}}catch(z){ml(t,t.return,z)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){ml(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){ml(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){ml(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){ml(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){ml(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){ml(l,l.return,u)}}function Hc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[ut]=t}catch(u){ml(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&je(l.type)||l.tag===4}function Rc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&je(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function xc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Lt));else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(xc(l,t,e),l=l.sibling;l!==null;)xc(l,t,e),l=l.sibling}function Un(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Un(l,t,e),l=l.sibling;l!==null;)Un(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[ut]=e}catch(n){ml(l,l.return,n)}}var le=!1,Yl=!1,qc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function cv(l,t){if(l=l.containerInfo,af=In,l=vs(l),Di(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,z=0,A=l,S=null;t:for(;;){for(var E;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(E=A.firstChild)!==null;)S=A,A=E;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++z===a&&(f=i),(E=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=E}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(uf={focusedElem:l,selectionRange:e},In=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cgl&&(i=gl,gl=X,X=i);var r=rs(c,X),s=rs(c,gl);if(r&&s&&(E.rangeCount!==1||E.anchorNode!==r.node||E.anchorOffset!==r.offset||E.focusNode!==s.node||E.focusOffset!==s.offset)){var y=A.createRange();y.setStart(r.node,r.offset),E.removeAllRanges(),X>gl?(E.addRange(y),E.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),E.addRange(y))}}}}for(A=[],E=c;E=E.parentNode;)E.nodeType===1&&A.push({element:E,left:E.scrollLeft,top:E.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Vc,Vc=null;var n=Ae,i=ne;if(Ql=0,Ra=Ae=null,ne=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{M.p=u,p.T=a,Co(l,t)}}function Ro(l,t,e){t=Mt(e,t),t=pc(l.stateNode,t,2),l=Se(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function ml(l,t,e){if(l.tag===3)Ro(l,l,e);else for(;t!==null;){if(t.tag===3){Ro(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(_e===null||!_e.has(a))){l=Mt(e,l),e=Rd(2),a=Se(t,e,2),a!==null&&(xd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function wc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Gc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,Sl===l&&(el&e)===e&&(Dl===4||Dl===3&&(el&62914560)===el&&300>D()-Rn?(dl&2)===0&&xa(l,0):Xc|=e,Ha===el&&(Ha=0)),Qt(l)}function xo(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),xo(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),xo(l,e)}function Sv(l,t){return ea(l,t)}var Qn=null,Ba=null,kc=!1,Zn=!1,Wc=!1,Me=0;function Qt(l){l!==Ba&&l.next===null&&(Ba===null?Qn=Ba=l:Ba=Ba.next=l),Zn=!0,kc||(kc=!0,Ev())}function Du(l,t){if(!Wc&&Zn){Wc=!0;do for(var e=!1,a=Qn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-rt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Ku(a,a===Sl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||ka(a,n)||(e=!0,Go(a,n));a=a.next}while(e);Wc=!1}}function bv(){qo()}function qo(){Zn=kc=!1;var l=0;Me!==0&&Nv()&&(l=Me);for(var t=D(),e=null,a=Qn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Qn=u:e.next=u,u===null&&(Ba=e)):(e=a,(l!==0||(n&3)!==0)&&(Zn=!0)),a=u}Ql!==0&&Ql!==5||Du(l),Me!==0&&(Me=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var z=f.transferSize,A=f.initiatorType;z&&wo(A)&&(f=f.responseEnd,i+=z*(f"u"?null:document;function nr(l,t,e){var a=Ya;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Gv(l){ie.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ie.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ie.L(l,t,e);var a=Ya;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Ga(l);break;case"script":n=Xa(l)}Ht.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Zv(l,t){ie.m(l,t);var e=Ya;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Xa(l)}if(!Ht.has(n)&&(l=R({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ie.S(l,t,e);var a=Ya;if(a&&l){var u=ca(a).hoistableStyles,n=Ga(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&rf(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(h,z){f.onload=h,f.onerror=z}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,wn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ie.X(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ie.M(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=Z.current)?Jn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Ga(e.href),e=ca(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Ga(e.href);var n=ca(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Xa(e),e=ca(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Ga(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Xa(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),wn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Ga(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=cr(e),(u=Ht.get(u))&&rf(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,wn(n,e.precedence,l),t.instance=n;case"script":return n=Xa(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=R({},e),mf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wn(a,e.precedence,l));return t.instance}function wn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function kv(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Ga(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=cr(a),(u=Ht.get(u))&&rf(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var vf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&Fn(l,l.stylesheets),0vf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var $n=null;function Fn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,$n=new Map,t.forEach($v,l),$n=null,Wn.call(l))}function $v(l,t){if(!(t.state.loading&4)){var e=$n.get(l);if(e)var a=e.get(null);else{e=new Map,$n.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Tf.exports=yy(),Tf.exports}var gy=hy();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const C=o.camera;if(_l.camera==="head")o.controls.target.set(0,10,0),C.position.set(10,12,18);else{o.controls.target.set(0,0,0);const j=48;_l.camera==="front"?C.position.set(0,0,j):_l.camera==="back"?C.position.set(0,0,-j):C.position.set(23,7,42)}C.lookAt(o.controls.target),C.updateProjectionMatrix(),o.controls.update()}function Gr(){_l.syncing=!0;try{_l.viewers.forEach(o=>Sy(o.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===_l.camera))}function by(o){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:C}of _l.viewers)C!==o&&(C.camera.position.copy(o.camera.position),C.camera.quaternion.copy(o.camera.quaternion),C.camera.zoom=o.camera.zoom,C.controls.target.copy(o.controls.target),C.camera.updateProjectionMatrix(),C.controls.update())}finally{_l.syncing=!1}}}function Ey(o,C,j){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let N;try{N=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),N.controls.enablePan=!1,N.controls.enableDamping=!1,N.controls.minDistance=12,N.controls.maxDistance=120,N.controls.addEventListener("change",()=>by(N));const L=new ResizeObserver(()=>{!N.disposed&&o.clientWidth&&o.clientHeight&&(N.width=o.clientWidth,N.height=o.clientHeight)});L.observe(o),_l.viewers.push({viewer:N,observer:L}),Promise.resolve(N.loadSkin(C.url,{model:"default"})).then(()=>{j!==_l.generation||N.disposed||(N.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{j===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{N&&!N.disposed&&N.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function zy(o,C){Ey(o,C,_l.generation),Gr();const j=_l.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||_l.viewers.at(-1);return()=>{j&&(j.observer.disconnect(),j.viewer.dispose(),j.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==j))}}function py(o,C,j){const v=_l.camera!==o;Object.assign(_l,{camera:o,outerLayer:C,uvOnly:j}),v&&Gr(),_l.viewers.forEach(({viewer:N})=>{N.playerObject.skin.setOuterLayerVisible(C),N.renderPaused=j})}async function ii(o,C,j){const v=await fetch("/api/meat-model/"+o,C===void 0?{signal:j}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C),signal:j}),N=await v.json();if(!v.ok)throw Error(N.error||"预选服务暂不可用");return N}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const C={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别 meat",complete:"已完成",failed:"失败"},j=o?.progress;return(C[o?.stage]||"正在预选")+(j?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型"}[j.variant]||"DINO+局部特征"} ${j.fold}/${j.total} 组`:j?.remaining?` · 剩余 ${j.remaining} 张`:j?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,C]=V.useState(null),[j,v]=V.useState(""),[N,L]=V.useState(!1),k=V.useRef(!0),nl=V.useRef(null),U=V.useRef(!1),T=async()=>{try{const Y=await ii("status");k.current&&(C(Y),v(""))}catch(Y){k.current&&v(Y.message)}};V.useEffect(()=>{k.current=!0,T();const Y=()=>T();return window.addEventListener("meat-saved",Y),nl.current=setInterval(T,1e4),()=>{k.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",Y)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const Y=await ii("train",{});k.current&&C(vl=>({...vl,training:Y}))}catch(Y){k.current&&v(Y.message)}finally{U.current=!1,k.current&&(L(!1),T())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"仅在点击按钮时训练并更新六面+表面结构模型;保存标注不会自动训练。已保存的细分类参与辅助训练,未细标格仍用于二分类。"}),o?.dataset&&g.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:R,disabled:N||Q||!o?.active||o?.dataset?.count<3,children:N?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&g.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是新皮肤准确率,预选仍需人工检查。"]}),!!o?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((Y,vl)=>g.jsxs("p",{children:[Y.id,":",Y.reason]},vl))]}),j&&g.jsx("p",{className:"meat-warning",role:"alert",children:j})]})}function Uy({data:o,disabled:C,onStart:j,onEnd:v,onApply:N}){const[L,k]=V.useState(!1),[nl,U]=V.useState(""),[T,Q]=V.useState(""),R=V.useRef(!0),Y=V.useRef(null),vl=V.useRef(!1);V.useEffect(()=>(R.current=!0,()=>{R.current=!1,Y.current?.abort()}),[]);const Al=async()=>{if(vl.current)return;vl.current=!0,k(!0),Q(""),U("正在请求预选…"),j(),Y.current=new AbortController;const Nl=Y.current.signal;try{let K=await ii("predict",{key:o.key,skin_revision:o.skin_revision},Nl);for(;!Xr(K.stage);){if(!R.current||(U(Qr(K)),await new Promise(bl=>setTimeout(bl,1500)),!R.current))return;K=await ii("job?id="+encodeURIComponent(K.id),void 0,Nl)}if(K.stage==="failed")throw Error(K.error||"预选失败,请稍后重试");if(K.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");R.current&&(N(K.prediction),U(`预选来自 ${K.prediction.model_id} · ${K.prediction.selected.length} 格。请检查并修改,再保存。`))}catch(K){R.current&&K.name!=="AbortError"&&(Q(K.message),U(""))}finally{vl.current=!1,R.current&&(k(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:Al,disabled:C||L||o.model!=="classic",children:L?"模型预选中…":"模型预选"}),g.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),nl&&g.jsx("p",{role:"status",children:nl}),T&&g.jsx("p",{role:"alert",className:"meat-warning",children:T})]})}const _y=V.lazy(()=>Yr(()=>import("./SkinEditor-DLV3L4Lz.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=V.lazy(()=>Yr(()=>import("./MeatEditor-BZS2SjzS.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ni=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,C)=>C==="all"||C==="perfect"&&!!o.perfect||C==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||C==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||C==="best"&&!!o.best||C==="ordinary"&&!!o.best&&!o.perfect||o.rejection===C,Br=o=>o.version==="original"?"原版":o.version;async function Za(o,C){const j=await fetch(o,C===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C)}),v=await j.json();if(!j.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const C=V.useRef(null);return V.useEffect(()=>zy(C.current,o),[o.url]),g.jsxs("div",{className:"skin-stage",ref:C,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,C]=V.useState([]),[j,v]=V.useState(null),[N,L]=V.useState("pending"),[k,nl]=V.useState("all"),[U,T]=V.useState(""),[Q,R]=V.useState(""),[Y,vl]=V.useState(new Set),[Al,Nl]=V.useState([]),[K,bl]=V.useState(!1),[Gl,Xl]=V.useState(null),[Fl,Et]=V.useState("angle"),[Zl,I]=V.useState(!0),[Ul,zt]=V.useState(!1),[et,Kl]=V.useState(null),[Ml,pt]=V.useState(null),[il,Il]=V.useState(null),[p,M]=V.useState(!1),H=V.useRef(!1),sl=V.useRef(null),ol=V.useRef(null),d=V.useRef(null),m=o.find(b=>b.key===j),O=(b,D=N,tl=U,Pl=Q,Ol=k)=>(!tl||ni(b)===tl)&&b.id.toLowerCase().includes(Pl.trim().toLowerCase())&&(D==="all"||D==="pending"&&b.results.length>0&&!Re(b)||D==="done"&&Re(b)&&My(b,Ol)||D==="rejected"&&!!b.rejection||D==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,Z=(b,D=!1)=>Xl({message:b,error:D}),F=(b,D=!0)=>{H.current||(D&&j&&j!==b&&Nl(tl=>[...tl,j]),v(b))},Rl=(b=N,D=U,tl=Q,Pl=Y)=>o.find(Ol=>O(Ol,b,D,tl)&&!Pl.has(Ol.key))?.key||null,El=(b=o,D=Y)=>{const tl=b.filter(Ol=>O(Ol)&&!D.has(Ol.key)&&Ol.key!==j),Pl=b.findIndex(Ol=>Ol.key===j);F((tl.find(Ol=>b.indexOf(Ol)>Pl)||tl[0])?.key||null)};async function ce(b=!1){if(!H.current){H.current=!0,bl(!0);try{const D=await Za(b?"/api/refresh":"/api/state",b?{}:void 0);C(D.items),v(D.items.find(tl=>tl.key===j&&O(tl))?.key||D.items.find(tl=>O(tl)&&!Y.has(tl.key))?.key||null),b&&Z("目录已刷新")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function Tt(b,D,tl){if(!(H.current||!m)){H.current=!0,bl(!0);try{const Pl=await Za("/api/"+b,{key:m.key,revision:m.revision,result:D?.name,reason:typeof D=="string"?D:void 0,png:tl}),Ol=o.map(Ja=>Ja.key===j?Pl.item:Ja);C(Ol);const at=new Set(Y);at.delete(j),vl(at),H.current=!1,pt(null),b!=="clear"&&El(Ol,at),Z(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}async function la(b=m){if(!(H.current||!b?.perfect)){H.current=!0,bl(!0);try{const D=await Za("/api/meat?key="+encodeURIComponent(b.key)),tl=await Za(`/api/meat-semantic?key=${encodeURIComponent(b.key)}`);M(!1),Il({...D,semantic:tl})}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}const Va=()=>{H.current||p&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(Il(null),M(!1))};async function Zt(b){if(!(H.current||!il)){H.current=!0,bl(!0);try{const D=await Za("/api/meat-semantic",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,semantic_revision:il.semantic.semantic_revision,labels:b});Il({...il,semantic:D}),M(!1),window.dispatchEvent(new Event("meat-saved")),Z("细分类已保存,meat 标注保持不变")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function La(b,D,tl){if(!(H.current||!il)){H.current=!0,bl(!0);try{const Pl=await Za("/api/meat",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,selected:b,assistance:tl});window.dispatchEvent(new Event("meat-saved"));const Ol=o.map(at=>at.key===il.key?Pl.item:at);if(C(Ol),Il(null),M(!1),Z("meat 已保存 · "+il.id+" · "+b.length+" 格"),H.current=!1,D){const at=Ol.findIndex(fe=>fe.key===il.key),aa=[...Ol.slice(at+1),...Ol.slice(0,at)].find(fe=>fe.perfect&&fe.meat_status!=="saved"&&(!U||ni(fe)===U)&&fe.id.toLowerCase().includes(Q.trim().toLowerCase()));aa?(F(aa.key),await la(aa)):Z("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}function ta(){if(H.current||!m)return;const b=new Set(Y);b.add(j),vl(b),El(o,b)}function Qu(){!H.current&&Al.length&&(v(Al.at(-1)),Nl(Al.slice(0,-1)))}V.useEffect(()=>{ce()},[]),V.useEffect(()=>py(Fl,Zl,Ul),[Fl,Zl,Ul,j]),V.useEffect(()=>{if(!Gl)return;const b=setTimeout(()=>Xl(null),Gl.error?8e3:3500);return()=>clearTimeout(b)},[Gl]),V.useEffect(()=>{et&&sl.current?.showModal()},[et]),V.useEffect(()=>{Ml&&ol.current?.showModal()},[Ml]),V.useEffect(()=>{il&&d.current?.showModal()},[il]),V.useEffect(()=>{const b=D=>{if(!(K||et||Ml||il||D.ctrlKey||D.metaKey||D.altKey||D.target.closest("input,select,textarea,[contenteditable]"))){if(D.key.toLowerCase()==="s")D.preventDefault(),ta();else if(D.key==="ArrowLeft")D.preventDefault(),Qu();else if(D.key==="ArrowRight")D.preventDefault(),El();else if(/^[1-9]$/.test(D.key)){const tl=m?.results[+D.key-1];tl&&(D.preventDefault(),Tt("choose",tl))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Bt=o.filter(b=>!U||ni(b)===U),xe=Bt.filter(Re).length,ea=xe+Bt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Bt.filter(Re).length,pending:Bt.filter(b=>b.results.length&&!Re(b)).length,rejected:Bt.filter(b=>b.rejection).length,all:Bt.length,no_results:Bt.filter(b=>!b.results.length).length},ci=b=>{H.current||(L(b),F(Rl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[xe," / ",ea]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${xe/(ea||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:K,onClick:()=>ce(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,D])=>g.jsxs("button",{"data-filter":b,disabled:K,className:N===b?"active":"",onClick:()=>ci(b),children:[D," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:K,value:U,onChange:b=>{T(b.target.value),F(Rl(N,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ni))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:K,value:Q,onChange:b=>{R(b.target.value),F(Rl(N,U,b.target.value))}})]}),N==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:K,value:k,onChange:b=>{const D=b.target.value;nl(D),F(o.find(tl=>O(tl,"done",U,Q,D)&&!Y.has(tl.key))?.key||null)},children:Object.entries(Oy).map(([b,D])=>g.jsxs("option",{value:b,children:[D," ·"," ",o.filter(tl=>O(tl,"done",U,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(Ty,{}),g.jsx("main",{children:m?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:m.folder}),g.jsx("h2",{id:"itemId",children:m.id}),g.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:K,value:j,onChange:b=>{const D=new Set(Y);D.delete(b.target.value),vl(D),F(b.target.value)},children:J.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,D,tl])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",D]}),g.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!tl,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:tl,title:m.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:tl||void 0,alt:D})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!tl,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:K||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:K||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Kl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:K,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),g.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:K,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,D])=>g.jsx("button",{"data-camera":b,className:Fl===b?"active":"",onClick:()=>Et(b),children:D},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:b=>I(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Ul,onClick:()=>zt(!Ul),children:Ul?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Ul?" uv-only":""),children:[m.results.map((b,D)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:Br(b)}),g.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":D+1})]}),g.jsx(jy,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Kl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:K||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:K||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:K,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:K,onClick:()=>{vl(new Set),L("pending"),T(""),R(""),F(Rl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:K||!Al.length,onClick:Qu,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:K||!m,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",Y.size," 项 · 忽略不保存"]})]}),Gl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(Gl.error?" error":""),children:Gl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>Kl(null),onClick:b=>{b.target===b.currentTarget&&Kl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),K||pt(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:()=>pt(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?g.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_y,{textureUrl:Ml.url,busy:K,onError:b=>Z(b,!0),onSubmit:b=>Tt("repair",Ml.result,b)})})})]}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]}),il&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),Va()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["meat 标注 · ",il.id," · ",il.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:Va,children:"关闭 ×"})]}),g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载 meat 标注器…"}),children:g.jsx(Ay,{data:il,busy:K,onSave:La,onSaveSemantic:Zt,onDirty:M},il.key)}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]})]})}gy.createRoot(document.getElementById("root")).render(g.jsx(Dy,{}));export{Uy as M,Ny as R,Mf as a,ry as b,cy as g,g as j,V as r}; diff --git a/best_annotator/static/assets/index-BM9rHn7B.css b/best_annotator/static/assets/index-BM9rHn7B.css new file mode 100644 index 0000000000000000000000000000000000000000..a621febf12d566a24cfc528a7284f983f83845dc --- /dev/null +++ b/best_annotator/static/assets/index-BM9rHn7B.css @@ -0,0 +1 @@ +:root{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;color:#1f2c3c;background:#f3f5f8;font-size:14px;--accent:#147d72;--border:#dfe5ed;--muted:#758194}*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #68b4ac;outline-offset:3px}button{color:inherit}h1,h2,p{margin:0}h1{font-size:19px;letter-spacing:-.4px}h2{font-size:24px;letter-spacing:.3px}button{transition:background .15s,border-color .15s}button:hover:not(:disabled){filter:brightness(.97)}[hidden]{display:none!important}.topbar{display:flex;align-items:center;gap:30px;justify-content:space-between;padding:22px 30px;background:#fff;border-bottom:1px solid var(--border)}.brand{display:flex;gap:12px;align-items:center}.brand-icon{display:grid;place-items:center;background:#183b39;color:#d5f5ed;border-radius:12px;width:42px;height:42px;font-size:25px;font-weight:750}.brand p{font-size:12px;color:var(--muted);margin-top:5px}.progress{width:235px;margin-left:auto}.progress>div:first-child{display:flex;justify-content:space-between;font-size:12px;margin-bottom:9px;color:var(--muted)}.progress strong{color:var(--accent);font-weight:650}.progress-track{height:5px;background:#e9eeef;border-radius:10px;overflow:hidden}.progress-track i{height:100%;width:0;display:block;background:var(--accent);transition:width .25s}.button{border:1px solid var(--border);border-radius:8px;background:#fff;padding:10px 15px;font-weight:550;white-space:nowrap}.button.primary{background:var(--accent);border-color:var(--accent);color:#fff}.button.tiny{padding:6px 11px;font-size:12px}.button.tiny[aria-pressed=true]{color:var(--accent);background:#e4f2ee;border-color:#94c8be}.filters{display:flex;align-items:center;gap:12px;padding:15px 30px;border-bottom:1px solid var(--border);background:#fff}.segments{display:flex;gap:3px;background:#f0f3f6;padding:4px;border-radius:9px;margin-right:auto}.segments button{border:0;background:transparent;border-radius:6px;padding:7px 12px;color:#677284;font-size:13px}.segments button.active{color:#175d55;background:#fff;box-shadow:0 1px 4px #20304016}.segments b{margin-left:6px;font-size:11px;font-weight:600;opacity:.8}select,input[type=search]{border:1px solid var(--border);border-radius:8px;background:#fff;padding:9px 11px;color:#48566a;min-width:0}input[type=search]{width:210px}#folder{max-width:255px}main{padding:24px 30px 115px;max-width:1900px;margin:auto}.item-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:20px}.eyebrow{font-size:11px;color:var(--accent);font-weight:650;letter-spacing:.4px;display:block;margin-bottom:7px}.item-heading p{color:var(--muted);font-size:12px;margin-top:7px}.jump{display:flex;align-items:center;gap:9px;font-size:12px;color:var(--muted)}#jump{max-width:285px}.workspace{display:grid;grid-template-columns:minmax(270px,29%) minmax(0,1fr);gap:24px;align-items:start}.panel{border:1px solid var(--border);border-radius:12px;background:#fff;overflow:hidden}.panel-title{padding:13px 14px;border-bottom:1px solid var(--border)}.source-image-button{display:block;width:100%;height:min(33vw,455px);min-height:300px;border:0;padding:16px;background:#fafbfc;cursor:zoom-in}.source-image-button img{height:100%;width:100%;object-fit:contain}.source-caption{display:flex;justify-content:space-between;padding:12px 16px;font-size:11px;color:var(--muted)}#sourceFlag{color:#9a7031}.save-note{padding:15px 16px;border-top:1px solid #edf0f4;color:#8891a1;font-size:11px;line-height:1.8}.save-note code{font-family:monospace;color:#657388}.saved-box{margin:5px 15px 15px;padding:12px;background:#edf7f2;border:1px solid #c6e2d7;border-radius:8px;display:flex;flex-direction:column;gap:7px;font-size:11px;color:#45746a}.saved-box strong{font-size:12px;word-break:break-all;color:#1d6758}.text-button{align-self:start;border:0;background:transparent;padding:0;font-size:11px;text-decoration:underline;color:#6e817b}.comparison-toolbar{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:0 0 13px;min-height:36px;flex-wrap:wrap}.camera-buttons{display:flex;align-items:center;gap:3px}.camera-buttons span{font-size:11px;color:var(--muted);margin-right:7px}.camera-buttons button{font-size:12px;border:1px solid transparent;background:transparent;border-radius:6px;padding:6px 9px;color:#687689}.camera-buttons button.active{background:#fff;border-color:var(--border);color:#263e49}.view-options{display:flex;align-items:center;gap:12px}.view-options label{display:flex;gap:4px;align-items:center;font-size:11px;color:#687689}input[type=checkbox]{accent-color:var(--accent)}.result-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.result-card{background:#fff;border:1px solid var(--border);border-radius:12px;overflow:hidden;min-width:0;display:flex;flex-direction:column}.result-card.selected{border:2px solid var(--accent);box-shadow:0 0 0 3px #147d7210}.result-header{display:flex;align-items:center;justify-content:space-between;padding:14px 12px 10px}.version-name{font-size:15px;font-weight:680}.version-number{display:inline-grid;place-items:center;border:1px solid #e1e5eb;border-radius:5px;width:21px;height:21px;font-size:11px;color:#929baa}.chosen-badge{font-size:10px;background:#e3f4ec;color:var(--accent);padding:3px 6px;border-radius:4px}.skin-stage{height:300px;background:radial-gradient(ellipse at 50% 45%,#fff,#edf1f5);position:relative;overflow:hidden}.skin-stage canvas{display:block;width:100%;height:100%;touch-action:none}.preview-status{position:absolute;inset:0;display:grid;place-items:center;padding:20px;color:#85909e;font-size:11px;text-align:center;pointer-events:none}.uv-area{padding:13px 10px;display:flex;align-items:center;justify-content:center;gap:12px;border-top:1px solid #edf0f4}.uv-button{padding:0;border:1px solid #e3e7ed;border-radius:4px;display:block;width:88px;height:88px;background-color:#f8f8f8;background-image:linear-gradient(45deg,#e1e4e8 25%,transparent 25%),linear-gradient(-45deg,#e1e4e8 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e1e4e8 75%),linear-gradient(-45deg,transparent 75%,#e1e4e8 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0;cursor:zoom-in;overflow:hidden}.uv-button img{display:block;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}.uv-caption{display:flex;flex-direction:column;gap:5px;font-size:10px;color:#96a0ad}.uv-caption strong{font-size:11px;color:#738095;font-weight:500}.result-actions{padding:0 12px 13px;margin-top:auto}.result-file{font-size:9px;color:#909aab;margin-bottom:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,monospace}.choose-button{width:100%;border-radius:7px;border:1px solid #bdd7cf;color:var(--accent);background:#edf6f2;padding:10px 4px;font-size:12px;font-weight:600}.selected .choose-button{color:#fff;background:var(--accent);border-color:var(--accent)}.preview-hint{font-size:11px;color:#8a95a6;text-align:center;margin-top:15px;line-height:1.8}.uv-only .skin-stage{display:none}.uv-only .uv-area{min-height:280px;padding:20px 12px;flex-direction:column;border-top:0}.uv-only .uv-button{width:100%;height:auto;aspect-ratio:1;max-width:300px}.uv-only .uv-caption{flex-direction:row}.no-result-card{padding:65px 30px;color:var(--muted);text-align:center;background:#fff;border:1px dashed #ccd5df;border-radius:12px;grid-column:1/-1}.no-result-card p{font-size:12px;margin-top:10px}.empty{text-align:center;padding:70px 20px;margin-top:30px}.empty-icon{display:grid;place-items:center;width:52px;height:52px;background:#eaf3ed;color:var(--accent);font-size:25px;border-radius:50%;margin:0 auto 18px}.empty h2{font-size:22px}.empty p{color:var(--muted);margin:12px 0 24px;line-height:1.8}.footer{position:fixed;bottom:0;left:0;right:0;background:#ffffffed;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-top:1px solid var(--border);padding:15px 30px;display:flex;align-items:center;justify-content:space-between;gap:20px;z-index:5}.navigation{display:flex;gap:10px}.keyboard-hint,.session-note{font-size:11px;color:#8190a0}kbd{font-family:inherit;font-size:10px;border:1px solid #d8dee6;background:#f8fafc;padding:2px 5px;border-radius:4px}.toast{position:fixed;bottom:89px;left:50%;transform:translate(-50%);max-width:85vw;padding:13px 22px;background:#1f433c;color:#fff;border-radius:9px;box-shadow:0 5px 22px #0002;z-index:10;font-size:13px}.toast.error{background:#9d3e3e}dialog{border:1px solid var(--border);border-radius:13px;padding:0;max-width:92vw;width:1000px;max-height:92vh;box-shadow:0 20px 100px #0004}dialog::backdrop{background:#14232bb3;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}.dialog-top{display:flex;align-items:center;justify-content:space-between;padding:15px 20px;border-bottom:1px solid var(--border);gap:20px;font-size:13px}.dialog-image{display:grid;place-items:center;padding:20px;overflow:auto;max-height:80vh;background:#eef0f2}.dialog-image img{display:block;max-width:100%;max-height:73vh;object-fit:contain}.dialog-image img.pixelated{image-rendering:pixelated;width:700px;height:700px}.busy{cursor:progress}@media(min-width:1700px){.skin-stage{height:370px}}@media(max-width:1100px){.workspace{grid-template-columns:280px minmax(0,1fr)}.result-grid{grid-template-columns:repeat(2,minmax(170px,1fr))}.skin-stage{height:255px}.keyboard-hint{display:none}.filters{flex-wrap:wrap}.segments{margin-right:0}main{padding-left:20px;padding-right:20px}.topbar,.filters{padding-left:20px;padding-right:20px}}@media(max-width:700px){.topbar{gap:10px;padding:15px}.brand p,.progress{display:none}.filters{padding:10px 15px}.segments{width:100%;justify-content:space-between}.segments button{padding:6px 8px}#folder,input[type=search]{width:calc(50% - 6px);max-width:none}main{padding:18px 15px 125px}.workspace{display:block}.source-panel{margin-bottom:20px}.source-image-button{height:280px;min-height:0}.item-heading{align-items:start;flex-direction:column;gap:12px}h2{font-size:19px}.jump{width:100%}#jump{max-width:none;flex:1}.result-grid{gap:9px;grid-template-columns:repeat(2,minmax(0,1fr))}.skin-stage{height:255px}.result-header{padding:12px 9px}.uv-area{gap:5px}.uv-button{width:74px;height:74px}.uv-caption{display:none}.footer{padding:12px 15px;flex-wrap:wrap;gap:9px}.navigation{width:100%}.navigation .button{flex:1}.session-note{font-size:10px}.comparison-toolbar{gap:10px}.view-options{margin-left:auto}}.reference-images{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));background:#fafbfc}.reference-image{min-width:0}.reference-image+.reference-image{border-left:1px solid var(--border)}.reference-image .panel-title{display:flex;align-items:center;gap:6px;padding:14px 12px;background:#fff;min-height:48px}.reference-image h3{font-size:12px;font-weight:650;margin:0;white-space:nowrap}.reference-image #sourceFlag{font-size:10px}.reference-image .source-image-button{height:295px;min-height:0;padding:10px}.missing-edited{height:295px;display:grid;place-items:center;font-size:12px;color:var(--muted);padding:12px}.reject-actions{padding:4px 14px 15px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.reject-button{font-size:12px;padding:10px 5px;white-space:normal;border-color:#e7c9bb;color:#8b4b36;background:#fff7f2}.reject-actions p{grid-column:1/-1;font-size:11px;color:var(--muted);line-height:1.7;margin-top:2px}.saved-box.rejected{background:#fff7f2;border-color:#e7c9bb;color:#8b4b36}.saved-box.rejected strong{color:#8b4b36}@media(min-width:1101px){.workspace{grid-template-columns:minmax(340px,29%) minmax(0,1fr)}}@media(min-width:701px)and (max-width:1100px){.reference-images{grid-template-columns:1fr}.reference-image+.reference-image{border-left:0;border-top:1px solid var(--border)}.reference-image .source-image-button,.missing-edited{height:200px}}@media(max-width:700px){.segments{flex-wrap:wrap;justify-content:flex-start;gap:3px}.segments button{flex:1 0 auto;padding:6px}.segments b{margin-left:3px}.reference-image .source-image-button,.missing-edited{height:240px}.source-caption{font-size:10px}.eyebrow{overflow-wrap:anywhere}}.perfect-button,.repair-button{display:block;width:100%;padding:10px 4px;border:1px solid #9ed9bb;border-radius:8px;background:#e9f8ef;color:#17704c;font-weight:600;margin-top:8px;cursor:pointer}.repair-button{background:#edf3ff;border-color:#b9c9ed;color:#35598a}button:disabled{opacity:.5;cursor:not-allowed}.editor-dialog{width:96vw;max-width:1600px;height:94vh;max-height:96vh;padding:16px}.editor-content{height:calc(100% - 68px);min-height:400px}.editor-surface{position:relative;color:#fff}.editor-submit{position:absolute;z-index:40;top:12px;left:50%;transform:translate(-50%);background:#237847;color:#fff;border-radius:8px;padding:10px 18px;font-weight:700}.editor-surface button{line-height:1.5}.editor-dialog .dialog-top{margin-bottom:8px}.annotation-filters{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:12px 30px;background:#fff;border-bottom:1px solid var(--border)}.annotation-filters label{font-weight:600}.annotation-filters span{color:var(--muted);font-size:12px}@media(max-width:700px){.annotation-filters{padding:12px 15px}}.editor-content{display:grid;grid-template-columns:clamp(200px,23vw,320px) minmax(0,1fr);gap:16px}.editor-reference{display:flex;flex-direction:column;min-height:0;padding:16px;background:#f4f6f8;border:1px solid var(--border);border-radius:8px;overflow:auto}.editor-reference h3{margin:0 0 12px;font-size:14px}.editor-reference img{width:100%;flex:1;min-height:0;object-fit:contain}.editor-reference p{color:var(--muted);line-height:1.7}.editor-canvas-panel{min-width:0;min-height:0;height:100%}.editor-surface button[title]{min-width:44px;min-height:44px;padding:9px;display:inline-flex;align-items:center;justify-content:center}.editor-surface button[title] svg{width:24px;height:24px;font-size:24px}.editor-surface .editor-submit{left:16px;transform:none}.editor-surface .editor-history-tools{top:64px}@media(max-width:800px){.editor-content{grid-template-columns:minmax(0,1fr);grid-template-rows:150px minmax(420px,1fr);height:auto;min-height:100%;gap:10px}.editor-reference{padding:10px;display:grid;grid-template-columns:110px minmax(0,1fr);align-items:center;gap:10px}.editor-reference h3{margin:0}.editor-reference img{height:128px}.editor-canvas-panel{height:620px}}.meat-dialog{width:min(1440px,96vw);max-width:96vw;max-height:96vh;padding:0;border:0;border-radius:16px;color:#243341;background:#f5f7f9}.meat-dialog::backdrop{background:#14202bb3}.meat-dialog .dialog-top{position:sticky;top:0;z-index:2;background:#fff}.meat-editor{padding:0 22px 20px}.meat-definition{line-height:1.6;color:#526371}.meat-warning{padding:12px;background:#fff0c8;border-radius:8px}.meat-toolbar{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:14px 0}.meat-toolbar label{display:flex;align-items:center;gap:7px}.meat-editor button,.meat-editor select{padding:9px 13px;border:1px solid #c7d3db;border-radius:8px;background:#fff;cursor:pointer;color:#253747}.meat-editor button.active{background:#daf6e9;border-color:#24916a;color:#126847}.meat-editor button:disabled{opacity:.45;cursor:default}.meat-workspace{display:grid;grid-template-columns:1.1fr 1fr;gap:20px}.meat-workspace section{min-width:0;padding:14px;background:#fff;border:1px solid #dce3e8;border-radius:12px}.meat-workspace h3{margin:0 0 12px;font-size:16px}.meat-workspace small{font-weight:400;font-size:12px;color:#607584;margin-left:8px}.meat-stage{height:490px;background:#e7ecf1;border-radius:8px;touch-action:none}.meat-views{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:10px}.meat-views button{padding:6px 9px}.meat-uv{width:100%;max-width:540px;display:block;margin:auto;image-rendering:pixelated;touch-action:none;cursor:crosshair;background:repeating-conic-gradient(#e4e9ed 0% 25%,#f7f9fa 0% 50%) 50%/16px 16px}.meat-footer{display:flex;gap:12px;align-items:center;justify-content:flex-end;margin-top:18px}.meat-footer>span{margin-right:auto}.meat-footer small{display:block;font-size:12px;color:#607584;margin-top:5px}.meat-footer .button:not(.secondary){background:#18775e;color:#fff;border-color:#18775e}.meat-entry{margin-top:12px}.meat-status{font-size:12px;color:#597567;margin:8px 0}@media(max-width:900px){.meat-workspace{grid-template-columns:1fr}.meat-stage{height:390px}.meat-footer{flex-wrap:wrap}.meat-footer>span{width:100%}.meat-editor{padding:0 12px 15px}}.meat-tolerance input{width:130px;accent-color:#18775e}.meat-tolerance output{min-width:3ch;font-variant-numeric:tabular-nums}.meat-help{font-size:13px;line-height:1.7;color:#526371;margin:12px 0}.meat-stage{cursor:grab}.meat-stage:active{cursor:grabbing} diff --git a/best_annotator/static/assets/index-BwpaCc7o.js b/best_annotator/static/assets/index-BwpaCc7o.js new file mode 100644 index 0000000000000000000000000000000000000000..ea347217eef8d3b1bf15dacdf535a502a584d985 --- /dev/null +++ b/best_annotator/static/assets/index-BwpaCc7o.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-CCEH8j8M.js","assets/OrbitControls-C_CiZNu6.js","assets/SkinEditor-CzI5mIez.css","assets/MeatEditor-BoUWELYo.js"])))=>i.map(i=>d[i]); +(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const w of D)if(w.type==="childList")for(const al of w.addedNodes)al.tagName==="LINK"&&al.rel==="modulepreload"&&v(al)}).observe(document,{childList:!0,subtree:!0});function R(D){const w={};return D.integrity&&(w.integrity=D.integrity),D.referrerPolicy&&(w.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?w.credentials="include":D.crossOrigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function v(D){if(D.ep)return;D.ep=!0;const w=R(D);fetch(D.href,w)}})();const er="modulepreload",ar=function(S){return"/"+S},_m={},qm=function(C,R,v){let D=Promise.resolve();if(R&&R.length>0){let N=function(A){return Promise.all(A.map(Z=>Promise.resolve(Z).then(B=>({status:"fulfilled",value:B}),B=>({status:"rejected",reason:B}))))};document.getElementsByTagName("link");const al=document.querySelector("meta[property=csp-nonce]"),yl=al?.nonce||al?.getAttribute("nonce");D=N(R.map(A=>{if(A=ar(A),A in _m)return;_m[A]=!0;const Z=A.endsWith(".css"),B=Z?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${B}`))return;const K=document.createElement("link");if(K.rel=Z?"stylesheet":er,Z||(K.as="script"),K.crossOrigin="",K.href=A,yl&&K.setAttribute("nonce",yl),document.head.appendChild(K),Z)return new Promise((Hl,Dl)=>{K.addEventListener("load",Hl),K.addEventListener("error",()=>Dl(new Error(`Unable to preload CSS for ${A}`)))})}))}function w(al){const yl=new Event("vite:preloadError",{cancelable:!0});if(yl.payload=al,window.dispatchEvent(yl),!yl.defaultPrevented)throw al}return D.then(al=>{for(const yl of al||[])yl.status==="rejected"&&w(yl.reason);return C().catch(w)})};function ur(S){return S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S}var Sf={exports:{}},Yu={};var pm;function nr(){if(pm)return Yu;pm=1;var S=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function R(v,D,w){var al=null;if(w!==void 0&&(al=""+w),D.key!==void 0&&(al=""+D.key),"key"in D){w={};for(var yl in D)yl!=="key"&&(w[yl]=D[yl])}else w=D;return D=w.ref,{$$typeof:S,type:v,key:al,ref:D!==void 0?D:null,props:w}}return Yu.Fragment=C,Yu.jsx=R,Yu.jsxs=R,Yu}var Am;function ir(){return Am||(Am=1,Sf.exports=nr()),Sf.exports}var z=ir(),bf={exports:{}},L={};var Om;function cr(){if(Om)return L;Om=1;var S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),al=Symbol.for("react.context"),yl=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),A=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),K=Symbol.iterator;function Hl(d){return d===null||typeof d!="object"?null:(d=K&&d[K]||d["@@iterator"],typeof d=="function"?d:null)}var Dl={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ql=Object.assign,ul={};function pl(d,m,O){this.props=d,this.context=m,this.refs=ul,this.updater=O||Dl}pl.prototype.isReactComponent={},pl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},pl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Yl(){}Yl.prototype=pl.prototype;function Gl(d,m,O){this.props=d,this.context=m,this.refs=ul,this.updater=O||Dl}var Fl=Gl.prototype=new Yl;Fl.constructor=Gl,Ql(Fl,pl.prototype),Fl.isPureReactComponent=!0;var bt=Array.isArray;function Zl(){}var $={H:null,A:null,T:null,S:null},jl=Object.prototype.hasOwnProperty;function zt(d,m,O){var U=O.ref;return{$$typeof:S,type:d,key:m,ref:U!==void 0?U:null,props:O}}function et(d,m){return zt(d.type,m,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===S}function Al(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var Et=/\/+/g;function gl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Al(""+d.key):m.toString(36)}function lt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function T(d,m,O,U,V){var Q=typeof d;(Q==="undefined"||Q==="boolean")&&(d=null);var k=!1;if(d===null)k=!0;else switch(Q){case"bigint":case"string":case"number":k=!0;break;case"object":switch(d.$$typeof){case S:case C:k=!0;break;case Z:return k=d._init,T(k(d._payload),m,O,U,V)}}if(k)return V=V(d),k=U===""?"."+gl(d,0):U,bt(V)?(O="",k!=null&&(O=k.replace(Et,"$&/")+"/"),T(V,m,O,"",function(ce){return ce})):V!=null&&(Kl(V)&&(V=et(V,O+(V.key==null||d&&d.key===V.key?"":(""+V.key).replace(Et,"$&/")+"/")+k)),m.push(V)),1;k=0;var Cl=U===""?".":U+":";if(bt(d))for(var Sl=0;Sl>>1,sl=T[cl];if(0>>1;clD(O,j))UD(V,O)?(T[cl]=V,T[U]=j,cl=U):(T[cl]=O,T[m]=j,cl=m);else if(UD(V,j))T[cl]=V,T[U]=j,cl=U;else break l}}return M}function D(T,M){var j=T.sortIndex-M.sortIndex;return j!==0?j:T.id-M.id}if(S.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var w=performance;S.unstable_now=function(){return w.now()}}else{var al=Date,yl=al.now();S.unstable_now=function(){return al.now()-yl}}var N=[],A=[],Z=1,B=null,K=3,Hl=!1,Dl=!1,Ql=!1,ul=!1,pl=typeof setTimeout=="function"?setTimeout:null,Yl=typeof clearTimeout=="function"?clearTimeout:null,Gl=typeof setImmediate<"u"?setImmediate:null;function Fl(T){for(var M=R(A);M!==null;){if(M.callback===null)v(A);else if(M.startTime<=T)v(A),M.sortIndex=M.expirationTime,C(N,M);else break;M=R(A)}}function bt(T){if(Ql=!1,Fl(T),!Dl)if(R(N)!==null)Dl=!0,Zl||(Zl=!0,Al());else{var M=R(A);M!==null&<(bt,M.startTime-T)}}var Zl=!1,$=-1,jl=5,zt=-1;function et(){return ul?!0:!(S.unstable_now()-ztT&&et());){var cl=B.callback;if(typeof cl=="function"){B.callback=null,K=B.priorityLevel;var sl=cl(B.expirationTime<=T);if(T=S.unstable_now(),typeof sl=="function"){B.callback=sl,Fl(T),M=!0;break t}B===R(N)&&v(N),Fl(T)}else v(N);B=R(N)}if(B!==null)M=!0;else{var d=R(A);d!==null&<(bt,d.startTime-T),M=!1}}break l}finally{B=null,K=j,Hl=!1}M=void 0}}finally{M?Al():Zl=!1}}}var Al;if(typeof Gl=="function")Al=function(){Gl(Kl)};else if(typeof MessageChannel<"u"){var Et=new MessageChannel,gl=Et.port2;Et.port1.onmessage=Kl,Al=function(){gl.postMessage(null)}}else Al=function(){pl(Kl,0)};function lt(T,M){$=pl(function(){T(S.unstable_now())},M)}S.unstable_IdlePriority=5,S.unstable_ImmediatePriority=1,S.unstable_LowPriority=4,S.unstable_NormalPriority=3,S.unstable_Profiling=null,S.unstable_UserBlockingPriority=2,S.unstable_cancelCallback=function(T){T.callback=null},S.unstable_forceFrameRate=function(T){0>T||125cl?(T.sortIndex=j,C(A,T),R(N)===null&&T===R(A)&&(Ql?(Yl($),$=-1):Ql=!0,lt(bt,j-cl))):(T.sortIndex=sl,C(N,T),Dl||Hl||(Dl=!0,Zl||(Zl=!0,Al()))),T},S.unstable_shouldYield=et,S.unstable_wrapCallback=function(T){var M=K;return function(){var j=K;K=M;try{return T.apply(this,arguments)}finally{K=j}}}})(Tf)),Tf}var jm;function sr(){return jm||(jm=1,Ef.exports=fr()),Ef.exports}var _f={exports:{}},Pl={};var Nm;function dr(){if(Nm)return Pl;Nm=1;var S=pf();function C(N){var A="https://react.dev/errors/"+N;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S)}catch(C){console.error(C)}}return S(),_f.exports=dr(),_f.exports}var Hm;function mr(){if(Hm)return Gu;Hm=1;var S=sr(),C=pf(),R=or();function v(l){var t="https://react.dev/errors/"+l;if(1sl||(l.current=cl[sl],cl[sl]=null,sl--)}function O(l,t){sl++,cl[sl]=l.current,l.current=t}var U=d(null),V=d(null),Q=d(null),k=d(null);function Cl(l,t){switch(O(Q,t),O(V,l),O(U,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?Jo(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=Jo(t),l=wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(U),O(U,l)}function Sl(){m(U),m(V),m(Q)}function ce(l){l.memoizedState!==null&&O(k,l);var t=U.current,e=wo(t,l.type);t!==e&&(O(V,l),O(U,e))}function Tt(l){V.current===l&&(m(U),m(V)),k.current===l&&(m(k),Ru._currentValue=j)}var la,Va;function Qt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==y[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Qt(e):""}function Zt(l,t){switch(l.tag){case 26:case 27:case 5:return Qt(l.type);case 16:return Qt("Lazy");case 13:return l.child!==t&&t!==null?Qt("Suspense Fallback"):Qt("Suspense");case 19:return Qt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Qt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Zt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,La=S.unstable_scheduleCallback,Ka=S.unstable_cancelCallback,g=S.unstable_shouldYield,x=S.unstable_requestPaint,X=S.unstable_now,Il=S.unstable_getCurrentPriorityLevel,El=S.unstable_ImmediatePriority,xe=S.unstable_UserBlockingPriority,Ct=S.unstable_NormalPriority,fe=S.unstable_LowPriority,Af=S.unstable_IdlePriority,Ym=S.log,Gm=S.unstable_setDisableYieldValue,Ja=null,dt=null;function se(l){if(typeof Ym=="function"&&Gm(l),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Ja,l)}catch{}}var ot=Math.clz32?Math.clz32:Zm,Xm=Math.log,Qm=Math.LN2;function Zm(l){return l>>>=0,l===0?32:31-(Xm(l)/Qm|0)|0}var Xu=256,Qu=262144,Zu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Vu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function wa(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Vm(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Of(){var l=Zu;return Zu<<=1,(Zu&62914560)===0&&(Zu=4194304),l}function ni(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function Lm(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,y=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var $m=/[\n"\\]/g;function pt(l){return l.replace($m,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function oi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?mi(l,i,_t(t)):e!=null?mi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Gf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){di(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),di(l)}function mi(l,t,e){t==="number"&&Ju(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function da(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gi=!1;if(Kt)try{var Ia={};Object.defineProperty(Ia,"passive",{get:function(){gi=!0}}),window.addEventListener("test",Ia,Ia),window.removeEventListener("test",Ia,Ia)}catch{gi=!1}var oe=null,Si=null,Wu=null;function Jf(){if(Wu)return Wu;var l,t=Si,e=t.length,a,u="value"in oe?oe.value:oe.textContent,n=u.length;for(l=0;l=tu),If=" ",Pf=!1;function ls(l,t){switch(l){case"keyup":return pv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ts(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ra=!1;function Ov(l,t){switch(l){case"compositionend":return ts(t);case"keypress":return t.which!==32?null:(Pf=!0,If);case"textInput":return l=t.data,l===If&&Pf?null:l;default:return null}}function Mv(l,t){if(ra)return l==="compositionend"||!_i&&ls(l,t)?(l=Jf(),Wu=Si=oe=null,ra=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=ss(e)}}function os(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?os(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function ms(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=Ju(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=Ju(l.document)}return t}function Oi(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var xv=Kt&&"documentMode"in document&&11>=document.documentMode,ya=null,Mi=null,nu=null,Di=!1;function vs(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Di||ya==null||ya!==Ju(a)||(a=ya,"selectionStart"in a&&Oi(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),nu&&uu(nu,a)||(nu=a,a=Zn(Mi,"onSelect"),0>=i,u-=i,Bt=1<<32-ot(t)+u|e<W?(ll=q,q=null):ll=q.sibling;var il=h(o,q,r[W],_);if(il===null){q===null&&(q=ll);break}l&&q&&il.alternate===null&&t(o,q),s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il,q=ll}if(W===r.length)return e(o,q),tl&&wt(o,W),Y;if(q===null){for(;WW?(ll=q,q=null):ll=q.sibling;var Ce=h(o,q,il.value,_);if(Ce===null){q===null&&(q=ll);break}l&&q&&Ce.alternate===null&&t(o,q),s=n(Ce,s,W),nl===null?Y=Ce:nl.sibling=Ce,nl=Ce,q=ll}if(il.done)return e(o,q),tl&&wt(o,W),Y;if(q===null){for(;!il.done;W++,il=r.next())il=p(o,il.value,_),il!==null&&(s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il);return tl&&wt(o,W),Y}for(q=a(q);!il.done;W++,il=r.next())il=b(q,o,W,il.value,_),il!==null&&(l&&il.alternate!==null&&q.delete(il.key===null?W:il.key),s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il);return l&&q.forEach(function(tr){return t(o,tr)}),tl&&wt(o,W),Y}function rl(o,s,r,_){if(typeof r=="object"&&r!==null&&r.type===Ql&&r.key===null&&(r=r.props.children),typeof r=="object"&&r!==null){switch(r.$$typeof){case Hl:l:{for(var Y=r.key;s!==null;){if(s.key===Y){if(Y=r.type,Y===Ql){if(s.tag===7){e(o,s.sibling),_=u(s,r.props.children),_.return=o,o=_;break l}}else if(s.elementType===Y||typeof Y=="object"&&Y!==null&&Y.$$typeof===jl&&we(Y)===s.type){e(o,s.sibling),_=u(s,r.props),ou(_,r),_.return=o,o=_;break l}e(o,s);break}else t(o,s);s=s.sibling}r.type===Ql?(_=Ze(r.props.children,o.mode,_,r.key),_.return=o,o=_):(_=un(r.type,r.key,r.props,null,o.mode,_),ou(_,r),_.return=o,o=_)}return i(o);case Dl:l:{for(Y=r.key;s!==null;){if(s.key===Y)if(s.tag===4&&s.stateNode.containerInfo===r.containerInfo&&s.stateNode.implementation===r.implementation){e(o,s.sibling),_=u(s,r.children||[]),_.return=o,o=_;break l}else{e(o,s);break}else t(o,s);s=s.sibling}_=xi(r,o.mode,_),_.return=o,o=_}return i(o);case jl:return r=we(r),rl(o,s,r,_)}if(lt(r))return H(o,s,r,_);if(Al(r)){if(Y=Al(r),typeof Y!="function")throw Error(v(150));return r=Y.call(r),G(o,s,r,_)}if(typeof r.then=="function")return rl(o,s,mn(r),_);if(r.$$typeof===Gl)return rl(o,s,fn(o,r),_);vn(o,r)}return typeof r=="string"&&r!==""||typeof r=="number"||typeof r=="bigint"?(r=""+r,s!==null&&s.tag===6?(e(o,s.sibling),_=u(s,r),_.return=o,o=_):(e(o,s),_=Ri(r,o.mode,_),_.return=o,o=_),i(o)):e(o,s)}return function(o,s,r,_){try{du=0;var Y=rl(o,s,r,_);return Oa=null,Y}catch(q){if(q===Aa||q===dn)throw q;var nl=vt(29,q,null,o.mode);return nl.lanes=_,nl.return=o,nl}}}var ke=qs(!0),Bs=qs(!1),he=!1;function wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wi(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ge(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Se(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(fl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=an(l),zs(l,null,e),t}return en(l,a,t,e),an(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}function ki(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var $i=!1;function vu(){if($i){var l=pa;if(l!==null)throw l}}function ru(l,t,e,a){$i=!1;var u=l.updateQueue;he=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,y=f.next;f.next=null,i===null?n=y:i.next=y,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=y:c.next=y,E.lastBaseUpdate=f))}if(n!==null){var p=u.baseState;i=0,E=y=f=null,c=n;do{var h=c.lane&-536870913,b=h!==c.lane;if(b?(P&h)===h:(a&h)===h){h!==0&&h===_a&&($i=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var H=l,G=c;h=t;var rl=e;switch(G.tag){case 1:if(H=G.payload,typeof H=="function"){p=H.call(rl,p,h);break l}p=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=G.payload,h=typeof H=="function"?H.call(rl,p,h):H,h==null)break l;p=B({},p,h);break l;case 2:he=!0}}h=c.callback,h!==null&&(l.flags|=64,b&&(l.flags|=8192),b=u.callbacks,b===null?u.callbacks=[h]:b.push(h))}else b={lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(y=E=b,f=p):E=E.next=b,i|=h;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;b=c,c=b.next,b.next=null,u.lastBaseUpdate=b,u.shared.pending=null}}while(!0);E===null&&(f=p),u.baseState=f,u.firstBaseUpdate=y,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=p}}function Ys(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Gs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=T.T,c={};T.T=c,yc(l,!1,t,e);try{var f=u(),y=T.S;if(y!==null&&y(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=Lv(f,a);gu(l,t,E,St(l))}else gu(l,t,a,St(l))}catch(p){gu(l,t,{then:function(){},status:"rejected",reason:p},St())}finally{M.p=n,i!==null&&c.types!==null&&(i.types=c.types),T.T=i}}function $v(){}function vc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=gd(l).queue;hd(l,u,t,j,e===null?$v:function(){return Sd(l),e(a)})}function gd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:j,baseState:j,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:j},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Sd(l){var t=gd(l);t.next===null&&(t=l.alternate.memoizedState),gu(l,t.next.queue,{},St())}function rc(){return Wl(Ru)}function bd(){return Ul().memoizedState}function zd(){return Ul().memoizedState}function Fv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=St();l=ge(e);var a=Se(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Vi()},l.payload=t;return}t=t.return}}function Iv(l,t,e){var a=St();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?Td(t,e):(e=Hi(l,t,e,a),e!==null&&(st(e,l,a),_d(e,t,a)))}function Ed(l,t,e){var a=St();gu(l,t,e,a)}function gu(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))Td(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,mt(c,i))return en(l,t,u,0),hl===null&&tn(),!1}catch{}if(e=Hi(l,t,u,a),e!==null)return st(e,l,a),_d(e,t,a),!0}return!1}function yc(l,t,e,a){if(a={lane:2,revertLane:wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Hi(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===J||t!==null&&t===J}function Td(l,t){Da=hn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function _d(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}var Su={readContext:Wl,use:bn,useCallback:Ol,useContext:Ol,useEffect:Ol,useImperativeHandle:Ol,useLayoutEffect:Ol,useInsertionEffect:Ol,useMemo:Ol,useReducer:Ol,useRef:Ol,useState:Ol,useDebugValue:Ol,useDeferredValue:Ol,useTransition:Ol,useSyncExternalStore:Ol,useId:Ol,useHostTransitionStatus:Ol,useFormState:Ol,useActionState:Ol,useOptimistic:Ol,useMemoCache:Ol,useCacheRefresh:Ol};Su.useEffectEvent=Ol;var pd={readContext:Wl,use:bn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:cd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,En(4194308,4,od.bind(null,t,l),e)},useLayoutEffect:function(l,t){return En(4194308,4,l,t)},useInsertionEffect:function(l,t){En(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){se(!0);try{l()}finally{se(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){se(!0);try{e(t)}finally{se(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=Iv.bind(null,J,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=fc(l);var t=l.queue,e=Ed.bind(null,J,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:oc,useDeferredValue:function(l,t){var e=tt();return mc(e,l,t)},useTransition:function(){var l=fc(!1);return l=hd.bind(null,J,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=J,u=tt();if(tl){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),hl===null)throw Error(v(349));(P&127)!==0||Ks(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,cd(ws.bind(null,a,n,l),[l]),a.flags|=2048,Na(9,{destroy:void 0},Js.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=hl.identifierPrefix;if(tl){var e=Yt,a=Bt;e=(a&~(1<<32-ot(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=gn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Pt(t)}}return zl(t),jc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&Pt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=Q.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Lo(l.nodeValue,e)),l||re(t,!0)}else l=Vn(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return zl(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zl(t),l=!1}else e=Gi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return zl(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zl(t),u=!1}else u=Gi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),zl(t),null);case 4:return Sl(),l===null&&Fc(t.stateNode.containerInfo),zl(t),null;case 10:return kt(t.type),zl(t),null;case 19:if(m(Nl),a=t.memoizedState,a===null)return zl(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Ml!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=yn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Es(e,l),e=e.sibling;return O(Nl,Nl.current&1|2),tl&&wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&X()>Cn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=yn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!tl)return zl(t),null}else 2*X()-a.renderingStartTime>Cn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=X(),l.sibling=null,e=Nl.current,O(Nl,u?e&1|2:e&1),tl&&wt(t,a.treeForkCount),l):(zl(t),null);case 22:case 23:return yt(t),Ii(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(zl(t),t.subtreeFlags&6&&(t.flags|=8192)):zl(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Rl),zl(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function a0(l,t){switch(Bi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Rl),Sl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(yt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Nl),null;case 4:return Sl(),null;case 10:return kt(t.type),null;case 22:case 23:return yt(t),Ii(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Rl),null;case 25:return null;default:return null}}function Wd(l,t){switch(Bi(t),t.tag){case 3:kt(Rl),Sl();break;case 26:case 27:case 5:Tt(t);break;case 4:Sl();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:m(Nl);break;case 10:kt(t.type);break;case 22:case 23:yt(t),Ii(),l!==null&&m(Je);break;case 24:kt(Rl)}}function Eu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){ol(t,t.return,c)}}function Ee(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,y=c;try{y()}catch(E){ol(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){ol(t,t.return,E)}}function kd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Gs(t,e)}catch(a){ol(l,l.return,a)}}}function $d(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){ol(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){ol(l,t,u)}}function Gt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){ol(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){ol(l,t,u)}else e.current=null}function Fd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){ol(l,l.return,u)}}function Nc(l,t,e){try{var a=l.stateNode;A0(a,l.type,e,t),a[at]=t}catch(u){ol(l,l.return,u)}}function Id(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function Uc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||Id(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Lt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Hc(l,t,e),l=l.sibling;l!==null;)Hc(l,t,e),l=l.sibling}function jn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(jn(l,t,e),l=l.sibling;l!==null;)jn(l,t,e),l=l.sibling}function Pd(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[at]=e}catch(n){ol(l,l.return,n)}}var le=!1,Bl=!1,Cc=!1,lo=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function u0(l,t){if(l=l.containerInfo,lf=$n,l=ms(l),Oi(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,y=0,E=0,p=l,h=null;t:for(;;){for(var b;p!==e||u!==0&&p.nodeType!==3||(c=i+u),p!==n||a!==0&&p.nodeType!==3||(f=i+a),p.nodeType===3&&(i+=p.nodeValue.length),(b=p.firstChild)!==null;)h=p,p=b;for(;;){if(p===l)break t;if(h===e&&++y===u&&(c=i),h===n&&++E===a&&(f=i),(b=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=b}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(tf={focusedElem:l,selectionRange:e},$n=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=cm("link","href",u).get(a+(e.href||""));if(i){for(var c=0;crl&&(i=rl,rl=G,G=i);var o=ds(c,G),s=ds(c,rl);if(o&&s&&(b.rangeCount!==1||b.anchorNode!==o.node||b.anchorOffset!==o.offset||b.focusNode!==s.node||b.focusOffset!==s.offset)){var r=p.createRange();r.setStart(o.node,o.offset),b.removeAllRanges(),G>rl?(b.addRange(r),b.extend(s.node,s.offset)):(r.setEnd(s.node,s.offset),b.addRange(r))}}}}for(p=[],b=c;b=b.parentNode;)b.nodeType===1&&p.push({element:b,left:b.scrollLeft,top:b.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,T.T=null,e=Xc,Xc=null;var n=Ae,i=ne;if(Xl=0,xa=Ae=null,ne=0,(fl&6)!==0)throw Error(v(331));var c=fl;if(fl|=4,mo(n.current),fo(n,n.current,i,e),fl=c,Du(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Ja,n)}catch{}return!0}finally{M.p=u,T.T=a,No(l,t)}}function Ho(l,t,e){t=Ot(e,t),t=bc(l.stateNode,t,2),l=Se(l,t,2),l!==null&&(Wa(l,2),Xt(l))}function ol(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(pe===null||!pe.has(a))){l=Ot(e,l),e=Hd(2),a=Se(t,e,2),a!==null&&(Cd(e,a,t,l),Wa(a,2),Xt(a));break}}t=t.return}}function Lc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new c0;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(qc=!0,u.add(e),l=m0.bind(null,l,t,e),t.then(l,l))}function m0(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,hl===l&&(P&e)===e&&(Ml===4||Ml===3&&(P&62914560)===P&&300>X()-Hn?(fl&2)===0&&qa(l,0):Bc|=e,Ra===P&&(Ra=0)),Xt(l)}function Co(l,t){t===0&&(t=Of()),l=Qe(l,t),l!==null&&(Wa(l,t),Xt(l))}function v0(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Co(l,e)}function r0(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Co(l,e)}function y0(l,t){return La(l,t)}var Gn=null,Ya=null,Kc=!1,Xn=!1,Jc=!1,Me=0;function Xt(l){l!==Ya&&l.next===null&&(Ya===null?Gn=Ya=l:Ya=Ya.next=l),Xn=!0,Kc||(Kc=!0,g0())}function Du(l,t){if(!Jc&&Xn){Jc=!0;do for(var e=!1,a=Gn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-ot(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Bo(a,n))}else n=P,n=Vu(a,a===hl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||wa(a,n)||(e=!0,Bo(a,n));a=a.next}while(e);Jc=!1}}function h0(){Ro()}function Ro(){Xn=Kc=!1;var l=0;Me!==0&&M0()&&(l=Me);for(var t=X(),e=null,a=Gn;a!==null;){var u=a.next,n=xo(a,t);n===0?(a.next=null,e===null?Gn=u:e.next=u,u===null&&(Ya=e)):(e=a,(l!==0||(n&3)!==0)&&(Xn=!0)),a=u}Xl!==0&&Xl!==5||Du(l),Me!==0&&(Me=0)}function xo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,p=f.initiatorType;E&&Ko(p)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function am(l,t,e){var a=Ga;if(a&&typeof t=="string"&&t){var u=pt(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),em.has(u)||(em.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function q0(l){ie.D(l),am("dns-prefetch",l,null)}function B0(l,t){ie.C(l,t),am("preconnect",l,t)}function Y0(l,t,e){ie.L(l,t,e);var a=Ga;if(a&&l&&t){var u='link[rel="preload"][as="'+pt(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+pt(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+pt(e.imageSizes)+'"]')):u+='[href="'+pt(l)+'"]';var n=u;switch(t){case"style":n=Xa(l);break;case"script":n=Qa(l)}Ht.has(n)||(l=B({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Cu(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function G0(l,t){ie.m(l,t);var e=Ga;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+pt(a)+'"][href="'+pt(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Qa(l)}if(!Ht.has(n)&&(l=B({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Cu(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function X0(l,t,e){ie.S(l,t,e);var a=Ga;if(a&&l){var u=fa(a).hoistableStyles,n=Xa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=B({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&sf(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(y,E){f.onload=y,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Kn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Q0(l,t){ie.X(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Cu(u)),n||(l=B({src:l,async:!0},t),(t=Ht.get(u))&&df(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Z0(l,t){ie.M(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Cu(u)),n||(l=B({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&df(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function um(l,t,e,a){var u=(u=Q.current)?Ln(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Xa(e.href),e=fa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Xa(e.href);var n=fa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||V0(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qa(e),e=fa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Xa(l){return'href="'+pt(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function nm(l){return B({},l,{"data-precedence":l.precedence,precedence:null})}function V0(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Qa(l){return'[src="'+pt(l)+'"]'}function Cu(l){return"script[async]"+l}function im(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+pt(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=B({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),Kn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Xa(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=nm(e),(u=Ht.get(u))&&sf(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,Kn(n,e.precedence,l),t.instance=n;case"script":return n=Qa(e.src),(u=l.querySelector(Cu(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=B({},e),df(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Kn(a,e.precedence,l));return t.instance}function Kn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function L0(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function sm(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function K0(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Xa(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=nm(a),(u=Ht.get(u))&&sf(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var of=0;function J0(l,t){return l.stylesheets&&l.count===0&&kn(l,l.stylesheets),0of?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Wn=null;function kn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Wn=new Map,t.forEach(w0,l),Wn=null,wn.call(l))}function w0(l,t){if(!(t.state.loading&4)){var e=Wn.get(l);if(e)var a=e.get(null);else{e=new Map,Wn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S)}catch(C){console.error(C)}}return S(),zf.exports=mr(),zf.exports}var rr=vr();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function yr(S){const C=S.camera;if(_l.camera==="head")S.controls.target.set(0,10,0),C.position.set(10,12,18);else{S.controls.target.set(0,0,0);const R=48;_l.camera==="front"?C.position.set(0,0,R):_l.camera==="back"?C.position.set(0,0,-R):C.position.set(23,7,42)}C.lookAt(S.controls.target),C.updateProjectionMatrix(),S.controls.update()}function Bm(){_l.syncing=!0;try{_l.viewers.forEach(S=>yr(S.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(S=>S.classList.toggle("active",S.dataset.camera===_l.camera))}function hr(S){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:C}of _l.viewers)C!==S&&(C.camera.position.copy(S.camera.position),C.camera.quaternion.copy(S.camera.quaternion),C.camera.zoom=S.camera.zoom,C.controls.target.copy(S.controls.target),C.camera.updateProjectionMatrix(),C.controls.update())}finally{_l.syncing=!1}}}function gr(S,C,R){const v=S.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:S.querySelector("canvas"),width:S.clientWidth||220,height:S.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>hr(D));const w=new ResizeObserver(()=>{!D.disposed&&S.clientWidth&&S.clientHeight&&(D.width=S.clientWidth,D.height=S.clientHeight)});w.observe(S),_l.viewers.push({viewer:D,observer:w}),Promise.resolve(D.loadSkin(C.url,{model:"default"})).then(()=>{R!==_l.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{R===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function Sr(S,C){gr(S,C,_l.generation),Bm();const R=_l.viewers.find(v=>v.viewer.canvas===S.querySelector("canvas"))||_l.viewers.at(-1);return()=>{R&&(R.observer.disconnect(),R.viewer.dispose(),R.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==R))}}function br(S,C,R){const v=_l.camera!==S;Object.assign(_l,{camera:S,outerLayer:C,uvOnly:R}),v&&Bm(),_l.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(C),D.renderPaused=R})}const zr=el.lazy(()=>qm(()=>import("./SkinEditor-CCEH8j8M.js"),__vite__mapDeps([0,1,2])).then(S=>({default:S.SkinEditor}))),Er=el.lazy(()=>qm(()=>import("./MeatEditor-BoUWELYo.js"),__vite__mapDeps([3,1]))),Re=S=>!!(S.best||S.rejection),ai=S=>S.model??S.folder,Rm=S=>S==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Tr={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},_r=(S,C)=>C==="all"||C==="perfect"&&!!S.perfect||C==="meat_pending"&&!!S.perfect&&S.meat_status!=="saved"||C==="meat_saved"&&!!S.perfect&&S.meat_status==="saved"||C==="best"&&!!S.best||C==="ordinary"&&!!S.best&&!S.perfect||S.rejection===C,xm=S=>S.version==="original"?"原版":S.version;async function ui(S,C){const R=await fetch(S,C===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C)}),v=await R.json();if(!R.ok)throw Error(v.error||"请求失败");return v}function pr({result:S}){const C=el.useRef(null);return el.useEffect(()=>Sr(C.current,S),[S.url]),z.jsxs("div",{className:"skin-stage",ref:C,children:[z.jsx("canvas",{}),z.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Ar(){const[S,C]=el.useState([]),[R,v]=el.useState(null),[D,w]=el.useState("pending"),[al,yl]=el.useState("all"),[N,A]=el.useState(""),[Z,B]=el.useState(""),[K,Hl]=el.useState(new Set),[Dl,Ql]=el.useState([]),[ul,pl]=el.useState(!1),[Yl,Gl]=el.useState(null),[Fl,bt]=el.useState("angle"),[Zl,$]=el.useState(!0),[jl,zt]=el.useState(!1),[et,Kl]=el.useState(null),[Al,Et]=el.useState(null),[gl,lt]=el.useState(null),[T,M]=el.useState(!1),j=el.useRef(!1),cl=el.useRef(null),sl=el.useRef(null),d=el.useRef(null),m=S.find(g=>g.key===R),O=(g,x=D,X=N,Il=Z,El=al)=>(!X||ai(g)===X)&&g.id.toLowerCase().includes(Il.trim().toLowerCase())&&(x==="all"||x==="pending"&&g.results.length>0&&!Re(g)||x==="done"&&Re(g)&&_r(g,El)||x==="rejected"&&!!g.rejection||x==="no_results"&&!g.results.length),U=S.filter(g=>O(g)),V=m&&!U.includes(m)?[m,...U]:U,Q=(g,x=!1)=>Gl({message:g,error:x}),k=(g,x=!0)=>{j.current||(x&&R&&R!==g&&Ql(X=>[...X,R]),v(g))},Cl=(g=D,x=N,X=Z,Il=K)=>S.find(El=>O(El,g,x,X)&&!Il.has(El.key))?.key||null,Sl=(g=S,x=K)=>{const X=g.filter(El=>O(El)&&!x.has(El.key)&&El.key!==R),Il=g.findIndex(El=>El.key===R);k((X.find(El=>g.indexOf(El)>Il)||X[0])?.key||null)};async function ce(g=!1){if(!j.current){j.current=!0,pl(!0);try{const x=await ui(g?"/api/refresh":"/api/state",g?{}:void 0);C(x.items),v(x.items.find(X=>X.key===R&&O(X))?.key||x.items.find(X=>O(X)&&!K.has(X.key))?.key||null),g&&Q("目录已刷新")}catch(x){Q(x.message,!0)}finally{j.current=!1,pl(!1)}}}async function Tt(g,x,X){if(!(j.current||!m)){j.current=!0,pl(!0);try{const Il=await ui("/api/"+g,{key:m.key,revision:m.revision,result:x?.name,reason:typeof x=="string"?x:void 0,png:X}),El=S.map(Ct=>Ct.key===R?Il.item:Ct);C(El);const xe=new Set(K);xe.delete(R),Hl(xe),j.current=!1,Et(null),g!=="clear"&&Sl(El,xe),Q(g==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(Il){Q(Il.message,!0)}finally{j.current=!1,pl(!1)}}}async function la(g=m){if(!(j.current||!g?.perfect)){j.current=!0,pl(!0);try{const x=await ui("/api/meat?key="+encodeURIComponent(g.key));M(!1),lt(x)}catch(x){Q(x.message,!0)}finally{j.current=!1,pl(!1)}}}const Va=()=>{j.current||T&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(lt(null),M(!1))};async function Qt(g,x){if(!(j.current||!gl)){j.current=!0,pl(!0);try{const X=await ui("/api/meat",{key:gl.key,revision:gl.revision,skin_revision:gl.skin_revision,meat_revision:gl.meat_revision,selected:g}),Il=S.map(El=>El.key===gl.key?X.item:El);if(C(Il),lt(null),M(!1),Q("meat 已保存 · "+gl.id+" · "+g.length+" 格"),j.current=!1,x){const El=Il.findIndex(fe=>fe.key===gl.key),Ct=[...Il.slice(El+1),...Il.slice(0,El)].find(fe=>fe.perfect&&fe.meat_status!=="saved"&&(!N||ai(fe)===N)&&fe.id.toLowerCase().includes(Z.trim().toLowerCase()));Ct?(k(Ct.key),await la(Ct)):Q("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(X){Q(X.message,!0)}finally{j.current=!1,pl(!1)}}}function ta(){if(j.current||!m)return;const g=new Set(K);g.add(R),Hl(g),Sl(S,g)}function ea(){!j.current&&Dl.length&&(v(Dl.at(-1)),Ql(Dl.slice(0,-1)))}el.useEffect(()=>{ce()},[]),el.useEffect(()=>br(Fl,Zl,jl),[Fl,Zl,jl,R]),el.useEffect(()=>{if(!Yl)return;const g=setTimeout(()=>Gl(null),Yl.error?8e3:3500);return()=>clearTimeout(g)},[Yl]),el.useEffect(()=>{et&&cl.current?.showModal()},[et]),el.useEffect(()=>{Al&&sl.current?.showModal()},[Al]),el.useEffect(()=>{gl&&d.current?.showModal()},[gl]),el.useEffect(()=>{const g=x=>{if(!(ul||et||Al||gl||x.ctrlKey||x.metaKey||x.altKey||x.target.closest("input,select,textarea,[contenteditable]"))){if(x.key.toLowerCase()==="s")x.preventDefault(),ta();else if(x.key==="ArrowLeft")x.preventDefault(),ea();else if(x.key==="ArrowRight")x.preventDefault(),Sl();else if(/^[1-9]$/.test(x.key)){const X=m?.results[+x.key-1];X&&(x.preventDefault(),Tt("choose",X))}}};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)});const Zt=S.filter(g=>!N||ai(g)===N),aa=Zt.filter(Re).length,ua=aa+Zt.filter(g=>g.results.length&&!Re(g)).length,La={done:Zt.filter(Re).length,pending:Zt.filter(g=>g.results.length&&!Re(g)).length,rejected:Zt.filter(g=>g.rejection).length,all:Zt.length,no_results:Zt.filter(g=>!g.results.length).length},Ka=g=>{j.current||(w(g),k(Cl(g)))};return z.jsxs(z.Fragment,{children:[z.jsxs("header",{className:"topbar",children:[z.jsxs("div",{className:"brand",children:[z.jsx("span",{className:"brand-icon",children:"D"}),z.jsxs("div",{children:[z.jsx("h1",{children:"DDJ 最佳结果标注"}),z.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),z.jsxs("div",{className:"progress",children:[z.jsxs("div",{children:[z.jsx("span",{children:"标注进度"}),z.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),z.jsx("div",{className:"progress-track",children:z.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),z.jsx("button",{id:"refresh",className:"button secondary",disabled:ul,onClick:()=>ce(!0),children:"刷新目录"})]}),z.jsxs("section",{className:"filters",children:[z.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([g,x])=>z.jsxs("button",{"data-filter":g,disabled:ul,className:D===g?"active":"",onClick:()=>Ka(g),children:[x," ",z.jsx("b",{id:`${{all:"total",no_results:"noResult"}[g]||g}Count`,children:La[g]})]},g))}),z.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:ul,value:N,onChange:g=>{A(g.target.value),k(Cl(D,g.target.value))},children:[z.jsx("option",{value:"",children:"所有模型"}),[...new Set(S.map(ai))].map(g=>z.jsx("option",{children:g},g))]}),z.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:ul,value:Z,onChange:g=>{B(g.target.value),k(Cl(D,N,g.target.value))}})]}),D==="done"&&z.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[z.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),z.jsx("select",{id:"annotationType",disabled:ul,value:al,onChange:g=>{const x=g.target.value;yl(x),k(S.find(X=>O(X,"done",N,Z,x)&&!K.has(X.key))?.key||null)},children:Object.entries(Tr).map(([g,x])=>z.jsxs("option",{value:g,children:[x," ·"," ",S.filter(X=>O(X,"done",N,Z,g)).length]},g))}),z.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),z.jsx("main",{children:m?z.jsxs(z.Fragment,{children:[z.jsxs("section",{className:"item-heading",children:[z.jsxs("div",{children:[z.jsx("span",{className:"eyebrow",children:m.folder}),z.jsx("h2",{id:"itemId",children:m.id}),z.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?Rm(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),z.jsxs("div",{className:"jump",children:[z.jsx("label",{htmlFor:"jump",children:"跳转条目"}),z.jsx("select",{id:"jump",disabled:ul,value:R,onChange:g=>{const x=new Set(K);x.delete(g.target.value),Hl(x),k(g.target.value)},children:V.map(g=>z.jsxs("option",{value:g.key,children:[g.perfect?"★ ":Re(g)?"✓ ":"",g.id]},g.key))})]})]}),z.jsxs("div",{className:"workspace",id:"workspace",children:[z.jsxs("aside",{className:"source-panel panel",children:[z.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([g,x,X])=>z.jsxs("section",{className:"reference-image",children:[z.jsxs("div",{className:"panel-title",children:[z.jsxs("h3",{children:[g," · ",x]}),z.jsx("span",{children:g==="source"&&m.source_error?"err 样例":""})]}),z.jsx("button",{hidden:!X,id:g==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:X,title:m.id+"_"+g}),children:z.jsx("img",{id:g+"Image",src:X||void 0,alt:x})}),g==="edited"&&z.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!X,children:"暂无 edited 图片"})]},g))}),z.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),z.jsxs("div",{className:"reject-actions",children:[z.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:ul||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),z.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:ul||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),z.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[z.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),z.jsx("strong",{id:"savedName",children:m.rejection?Rm(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&z.jsx("button",{className:"text-button",onClick:()=>Kl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&z.jsxs("div",{className:"meat-entry",children:[z.jsx("button",{id:"annotateMeat",className:"button",disabled:ul,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),z.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),z.jsx("button",{id:"clearBest",className:"text-button",disabled:ul,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),z.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),z.jsxs("section",{className:"comparison",children:[z.jsxs("div",{className:"comparison-toolbar",children:[z.jsxs("div",{className:"camera-buttons",children:[z.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([g,x])=>z.jsx("button",{"data-camera":g,className:Fl===g?"active":"",onClick:()=>bt(g),children:x},g))]}),z.jsxs("div",{className:"view-options",children:[z.jsxs("label",{children:[z.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:g=>$(g.target.checked)}),"显示外层"]}),z.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":jl,onClick:()=>zt(!jl),children:jl?"显示 3D":"只看 UV"})]})]}),z.jsxs("div",{id:"results",className:"result-grid"+(jl?" uv-only":""),children:[m.results.map((g,x)=>z.jsxs("article",{"data-result":g.name,className:"result-card"+(m.best===g.name?" selected":""),children:[z.jsxs("div",{className:"result-header",children:[z.jsx("span",{className:"version-name",children:xm(g)}),z.jsx("span",{className:m.best===g.name?"chosen-badge":"version-number",children:m.best===g.name?m.perfect?"最佳 · 完美":"已选最佳":x+1})]}),z.jsx(pr,{result:g}),z.jsxs("div",{className:"uv-area",children:[z.jsx("button",{className:"uv-button",onClick:()=>Kl({url:g.url,title:g.name,pixelated:!0}),children:z.jsx("img",{src:g.url,alt:xm(g)+" 的 UV 贴图"})}),z.jsxs("div",{className:"uv-caption",children:[z.jsx("strong",{children:"UV 贴图"}),z.jsx("span",{children:"点击放大"})]})]}),z.jsxs("div",{className:"result-actions",children:[z.jsx("div",{className:"result-file",children:g.name}),z.jsx("button",{className:"choose-button",disabled:ul||m.best===g.name&&!m.perfect,onClick:()=>Tt("choose",g),children:m.best===g.name&&!m.perfect?"当前最佳":"选为最佳"}),z.jsx("button",{className:"perfect-button",disabled:ul||m.perfect===g.name&&!m.perfect_url,onClick:()=>Tt("perfect",g),children:"选为最佳(完美)"}),z.jsx("button",{className:"repair-button",disabled:ul,onClick:()=>Et({result:g,url:m.perfect===g.name&&m.perfect_url?m.perfect_url:g.url}),children:"修复并选为最佳(完美)"})]})]},m.key+g.name)),!m.results.length&&z.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),z.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):z.jsxs("section",{id:"empty",className:"empty panel",children:[z.jsx("h2",{children:"当前筛选下没有更多条目"}),z.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),z.jsx("button",{id:"resume",className:"button primary",disabled:ul,onClick:()=>{Hl(new Set),w("pending"),A(""),B(""),k(Cl("pending","","",new Set))},children:"继续查看待标注"})]})}),z.jsxs("footer",{className:"footer",children:[z.jsxs("div",{className:"navigation",children:[z.jsx("button",{id:"previous",className:"button secondary",disabled:ul||!Dl.length,onClick:ea,children:"← 上一个"}),z.jsx("button",{id:"skip",className:"button secondary",disabled:ul||!m,onClick:ta,children:"暂时忽略 →"})]}),z.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),z.jsxs("span",{children:["本次已忽略 ",K.size," 项 · 忽略不保存"]})]}),Yl&&z.jsx("div",{id:"toast",role:"status",className:"toast"+(Yl.error?" error":""),children:Yl.message}),et&&z.jsxs("dialog",{id:"imageDialog",ref:cl,onCancel:()=>Kl(null),onClick:g=>{g.target===g.currentTarget&&Kl(null)},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsx("span",{children:et.title}),z.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),z.jsx("div",{className:"dialog-image",children:z.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Al&&z.jsxs("dialog",{className:"editor-dialog",ref:sl,onCancel:g=>{g.preventDefault(),ul||Et(null)},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsxs("span",{children:["修复 ",Al.result.name," · 左键绘制,右键旋转"]}),z.jsx("button",{className:"button secondary",disabled:ul,onClick:()=>Et(null),children:"取消 ×"})]}),z.jsxs("div",{className:"editor-content",children:[z.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[z.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?z.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):z.jsx("p",{children:"此条目暂无 edited 图片"})]}),z.jsx("div",{className:"editor-canvas-panel",children:z.jsx(el.Suspense,{fallback:z.jsx("p",{children:"正在加载皮肤编辑器…"}),children:z.jsx(zr,{textureUrl:Al.url,busy:ul,onError:g=>Q(g,!0),onSubmit:g=>Tt("repair",Al.result,g)})})})]}),Yl?.error&&z.jsx("p",{role:"alert",children:Yl.message})]}),gl&&z.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:g=>{g.preventDefault(),Va()},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsxs("span",{children:["meat 标注 · ",gl.id," · ",gl.model==="slim"?"纤细手臂":"标准手臂"]}),z.jsx("button",{className:"button secondary",disabled:ul,onClick:Va,children:"关闭 ×"})]}),z.jsx(el.Suspense,{fallback:z.jsx("p",{children:"正在加载 meat 标注器…"}),children:z.jsx(Er,{data:gl,busy:ul,onSave:Qt,onDirty:M},gl.key)}),Yl?.error&&z.jsx("p",{role:"alert",children:Yl.message})]})]})}rr.createRoot(document.getElementById("root")).render(z.jsx(Ar,{}));export{Or as R,pf as a,sr as b,ur as g,z as j,el as r}; diff --git a/best_annotator/static/assets/index-CK5rLR8o.js b/best_annotator/static/assets/index-CK5rLR8o.js new file mode 100644 index 0000000000000000000000000000000000000000..9f72576091e13ee287cca5f5f58ab44d84480c68 --- /dev/null +++ b/best_annotator/static/assets/index-CK5rLR8o.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-VMsAFhH-.js","assets/OrbitControls-DmqzLDA6.js","assets/SkinEditor-BzPsKcct.css","assets/MeatEditor-C07kxdt0.js"])))=>i.map(i=>d[i]); +(function(){const U=document.createElement("link").relList;if(U&&U.supports&&U.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const V of D)if(V.type==="childList")for(const k of V.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&v(k)}).observe(document,{childList:!0,subtree:!0});function M(D){const V={};return D.integrity&&(V.integrity=D.integrity),D.referrerPolicy&&(V.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?V.credentials="include":D.crossOrigin==="anonymous"?V.credentials="omit":V.credentials="same-origin",V}function v(D){if(D.ep)return;D.ep=!0;const V=M(D);fetch(D.href,V)}})();const ny="modulepreload",iy=function(m){return"/"+m},_r={},Br=function(U,M,v){let D=Promise.resolve();if(M&&M.length>0){let N=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(H=>({status:"fulfilled",value:H}),H=>({status:"rejected",reason:H}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),nl=k?.nonce||k?.getAttribute("nonce");D=N(M.map(T=>{if(T=iy(T),T in _r)return;_r[T]=!0;const Q=T.endsWith(".css"),H=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${H}`))return;const Y=document.createElement("link");if(Y.rel=Q?"stylesheet":ny,Q||(Y.as="script"),Y.crossOrigin="",Y.href=T,nl&&Y.setAttribute("nonce",nl),document.head.appendChild(Y),Q)return new Promise((ml,Al)=>{Y.addEventListener("load",ml),Y.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function V(k){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=k,window.dispatchEvent(nl),!nl.defaultPrevented)throw k}return D.then(k=>{for(const nl of k||[])nl.status==="rejected"&&V(nl.reason);return U().catch(V)})};function cy(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var zf={exports:{}},Gu={};var Ar;function fy(){if(Ar)return Gu;Ar=1;var m=Symbol.for("react.transitional.element"),U=Symbol.for("react.fragment");function M(v,D,V){var k=null;if(V!==void 0&&(k=""+V),D.key!==void 0&&(k=""+D.key),"key"in D){V={};for(var nl in D)nl!=="key"&&(V[nl]=D[nl])}else V=D;return D=V.ref,{$$typeof:m,type:v,key:k,ref:D!==void 0?D:null,props:V}}return Gu.Fragment=U,Gu.jsx=M,Gu.jsxs=M,Gu}var Or;function sy(){return Or||(Or=1,zf.exports=fy()),zf.exports}var g=sy(),Ef={exports:{}},W={};var Mr;function dy(){if(Mr)return W;Mr=1;var m=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),k=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),Y=Symbol.iterator;function ml(d){return d===null||typeof d!="object"?null:(d=Y&&d[Y]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,K={};function pl(d,r,O){this.props=d,this.context=r,this.refs=K,this.updater=O||Al}pl.prototype.isReactComponent={},pl.prototype.setState=function(d,r){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,r,"setState")},pl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Gl(){}Gl.prototype=pl.prototype;function Xl(d,r,O){this.props=d,this.context=r,this.refs=K,this.updater=O||Al}var Fl=Xl.prototype=new Gl;Fl.constructor=Xl,Nl(Fl,pl.prototype),Fl.isPureReactComponent=!0;var bt=Array.isArray;function Zl(){}var P={H:null,A:null,T:null,S:null},Ul=Object.prototype.hasOwnProperty;function zt(d,r,O){var R=O.ref;return{$$typeof:m,type:d,key:r,ref:R!==void 0?R:null,props:O}}function et(d,r){return zt(d.type,r,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===m}function Ml(d){var r={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return r[O]})}var Et=/\/+/g;function Sl(d,r){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):r.toString(36)}function Pl(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(r){d.status==="pending"&&(d.status="fulfilled",d.value=r)},function(r){d.status==="pending"&&(d.status="rejected",d.reason=r)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,r,O,R,w){var L=typeof d;(L==="undefined"||L==="boolean")&&(d=null);var I=!1;if(d===null)I=!0;else switch(L){case"bigint":case"string":case"number":I=!0;break;case"object":switch(d.$$typeof){case m:case U:I=!0;break;case Q:return I=d._init,p(I(d._payload),r,O,R,w)}}if(I)return w=w(d),I=R===""?"."+Sl(d,0):R,bt(w)?(O="",I!=null&&(O=I.replace(Et,"$&/")+"/"),p(w,r,O,"",function(fe){return fe})):w!=null&&(Kl(w)&&(w=et(w,O+(w.key==null||d&&d.key===w.key?"":(""+w.key).replace(Et,"$&/")+"/")+I)),r.push(w)),1;I=0;var Rl=R===""?".":R+":";if(bt(d))for(var bl=0;bl>>1,dl=p[fl];if(0>>1;flD(O,C))RD(w,O)?(p[fl]=w,p[R]=C,fl=R):(p[fl]=O,p[r]=C,fl=r);else if(RD(w,C))p[fl]=w,p[R]=C,fl=R;else break l}}return j}function D(p,j){var C=p.sortIndex-j.sortIndex;return C!==0?C:p.id-j.id}if(m.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var V=performance;m.unstable_now=function(){return V.now()}}else{var k=Date,nl=k.now();m.unstable_now=function(){return k.now()-nl}}var N=[],T=[],Q=1,H=null,Y=3,ml=!1,Al=!1,Nl=!1,K=!1,pl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,Xl=typeof setImmediate<"u"?setImmediate:null;function Fl(p){for(var j=M(T);j!==null;){if(j.callback===null)v(T);else if(j.startTime<=p)v(T),j.sortIndex=j.expirationTime,U(N,j);else break;j=M(T)}}function bt(p){if(Nl=!1,Fl(p),!Al)if(M(N)!==null)Al=!0,Zl||(Zl=!0,Ml());else{var j=M(T);j!==null&&Pl(bt,j.startTime-p)}}var Zl=!1,P=-1,Ul=5,zt=-1;function et(){return K?!0:!(m.unstable_now()-ztp&&et());){var fl=H.callback;if(typeof fl=="function"){H.callback=null,Y=H.priorityLevel;var dl=fl(H.expirationTime<=p);if(p=m.unstable_now(),typeof dl=="function"){H.callback=dl,Fl(p),j=!0;break t}H===M(N)&&v(N),Fl(p)}else v(N);H=M(N)}if(H!==null)j=!0;else{var d=M(T);d!==null&&Pl(bt,d.startTime-p),j=!1}}break l}finally{H=null,Y=C,ml=!1}j=void 0}}finally{j?Ml():Zl=!1}}}var Ml;if(typeof Xl=="function")Ml=function(){Xl(Kl)};else if(typeof MessageChannel<"u"){var Et=new MessageChannel,Sl=Et.port2;Et.port1.onmessage=Kl,Ml=function(){Sl.postMessage(null)}}else Ml=function(){pl(Kl,0)};function Pl(p,j){P=pl(function(){p(m.unstable_now())},j)}m.unstable_IdlePriority=5,m.unstable_ImmediatePriority=1,m.unstable_LowPriority=4,m.unstable_NormalPriority=3,m.unstable_Profiling=null,m.unstable_UserBlockingPriority=2,m.unstable_cancelCallback=function(p){p.callback=null},m.unstable_forceFrameRate=function(p){0>p||125fl?(p.sortIndex=C,U(T,p),M(N)===null&&p===M(T)&&(Nl?(Gl(P),P=-1):Nl=!0,Pl(bt,C-fl))):(p.sortIndex=dl,U(N,p),Al||ml||(Al=!0,Zl||(Zl=!0,Ml()))),p},m.unstable_shouldYield=et,m.unstable_wrapCallback=function(p){var j=Y;return function(){var C=Y;Y=j;try{return p.apply(this,arguments)}finally{Y=C}}}})(_f)),_f}var Nr;function ry(){return Nr||(Nr=1,Tf.exports=oy()),Tf.exports}var Af={exports:{}},Il={};var Ur;function my(){if(Ur)return Il;Ur=1;var m=Of();function U(N){var T="https://react.dev/errors/"+N;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m)}catch(U){console.error(U)}}return m(),Af.exports=my(),Af.exports}var Hr;function yy(){if(Hr)return Xu;Hr=1;var m=ry(),U=Of(),M=vy();function v(l){var t="https://react.dev/errors/"+l;if(1dl||(l.current=fl[dl],fl[dl]=null,dl--)}function O(l,t){dl++,fl[dl]=l.current,l.current=t}var R=d(null),w=d(null),L=d(null),I=d(null);function Rl(l,t){switch(O(L,t),O(w,l),O(R,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?wo(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=wo(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}r(R),O(R,l)}function bl(){r(R),r(w),r(L)}function fe(l){l.memoizedState!==null&&O(I,l);var t=R.current,e=Wo(t,l.type);t!==e&&(O(w,l),O(R,e))}function pt(l){w.current===l&&(r(R),r(w)),I.current===l&&(r(I),xu._currentValue=C)}var la,Va;function Qt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==h[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Qt(e):""}function Zt(l,t){switch(l.tag){case 26:case 27:case 5:return Qt(l.type);case 16:return Qt("Lazy");case 13:return l.child!==t&&t!==null?Qt("Suspense Fallback"):Qt("Suspense");case 19:return Qt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Qt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Zt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,La=m.unstable_scheduleCallback,Ka=m.unstable_cancelCallback,b=m.unstable_shouldYield,q=m.unstable_requestPaint,J=m.unstable_now,lt=m.unstable_getCurrentPriorityLevel,Ol=m.unstable_ImmediatePriority,Tt=m.unstable_UserBlockingPriority,se=m.unstable_NormalPriority,Ja=m.unstable_LowPriority,Vt=m.unstable_IdlePriority,Qr=m.log,Zr=m.unstable_setDisableYieldValue,wa=null,dt=null;function de(l){if(typeof Qr=="function"&&Zr(l),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(wa,l)}catch{}}var ot=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Qu=256,Zu=262144,Vu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Lu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function Wa(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mf(){var l=Vu;return Vu<<=1,(Vu&62914560)===0&&(Vu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function ka(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Xf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&wu(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function da(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,zi=null,ku=null;function wf(){if(ku)return ku;var l,t=zi,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),Pf=" ",ls=!1;function ts(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function es(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var va=!1;function Dm(l,t){switch(l){case"compositionend":return es(t);case"keypress":return t.which!==32?null:(ls=!0,Pf);case"textInput":return l=t.data,l===Pf&&ls?null:l;default:return null}}function Nm(l,t){if(va)return l==="compositionend"||!Ai&&ts(l,t)?(l=wf(),ku=zi=re=null,va=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=ds(e)}}function rs(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?rs(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function ms(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=wu(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=wu(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ya=null,Di=null,iu=null,Ni=!1;function vs(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ya==null||ya!==wu(a)||(a=ya,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Vn(Di,"onSelect"),0>=i,u-=i,Bt=1<<32-ot(t)+u|e<F?(al=B,B=null):al=B.sibling;var cl=S(o,B,y[F],_);if(cl===null){B===null&&(B=al);break}l&&B&&cl.alternate===null&&t(o,B),s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl,B=al}if(F===y.length)return e(o,B),ul&&Wt(o,F),G;if(B===null){for(;FF?(al=B,B=null):al=B.sibling;var Re=S(o,B,cl.value,_);if(Re===null){B===null&&(B=al);break}l&&B&&Re.alternate===null&&t(o,B),s=n(Re,s,F),il===null?G=Re:il.sibling=Re,il=Re,B=al}if(cl.done)return e(o,B),ul&&Wt(o,F),G;if(B===null){for(;!cl.done;F++,cl=y.next())cl=A(o,cl.value,_),cl!==null&&(s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl);return ul&&Wt(o,F),G}for(B=a(B);!cl.done;F++,cl=y.next())cl=z(B,o,F,cl.value,_),cl!==null&&(l&&cl.alternate!==null&&B.delete(cl.key===null?F:cl.key),s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl);return l&&B.forEach(function(uy){return t(o,uy)}),ul&&Wt(o,F),G}function hl(o,s,y,_){if(typeof y=="object"&&y!==null&&y.type===Nl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case ml:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===Nl){if(s.tag===7){e(o,s.sibling),_=u(s,y.props.children),_.return=o,o=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ul&&we(G)===s.type){e(o,s.sibling),_=u(s,y.props),ru(_,y),_.return=o,o=_;break l}e(o,s);break}else t(o,s);s=s.sibling}y.type===Nl?(_=Ze(y.props.children,o.mode,_,y.key),_.return=o,o=_):(_=nn(y.type,y.key,y.props,null,o.mode,_),ru(_,y),_.return=o,o=_)}return i(o);case Al:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(o,s.sibling),_=u(s,y.children||[]),_.return=o,o=_;break l}else{e(o,s);break}else t(o,s);s=s.sibling}_=Bi(y,o.mode,_),_.return=o,o=_}return i(o);case Ul:return y=we(y),hl(o,s,y,_)}if(Pl(y))return x(o,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(o,s,y,_)}if(typeof y.then=="function")return hl(o,s,mn(y),_);if(y.$$typeof===Xl)return hl(o,s,sn(o,y),_);vn(o,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(o,s.sibling),_=u(s,y),_.return=o,o=_):(e(o,s),_=qi(y,o.mode,_),_.return=o,o=_),i(o)):e(o,s)}return function(o,s,y,_){try{ou=0;var G=hl(o,s,y,_);return Oa=null,G}catch(B){if(B===Aa||B===on)throw B;var il=mt(29,B,null,o.mode);return il.lanes=_,il.return=o,il}}}var ke=Bs(!0),Ys=Bs(!1),ge=!1;function ki(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $i(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(sl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=un(l),Es(l,null,e),t}return an(l,a,t,e),un(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=_a;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=h:c.next=h,E.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,E=h=f=null,c=n;do{var S=c.lane&-536870913,z=S!==c.lane;if(z?(el&S)===S:(a&S)===S){S!==0&&S===Ta&&(Ii=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var x=l,X=c;S=t;var hl=e;switch(X.tag){case 1:if(x=X.payload,typeof x=="function"){A=x.call(hl,A,S);break l}A=x;break l;case 3:x.flags=x.flags&-65537|128;case 0:if(x=X.payload,S=typeof x=="function"?x.call(hl,A,S):x,S==null)break l;A=H({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,z&&(l.flags|=8192),z=u.callbacks,z===null?u.callbacks=[S]:z.push(S))}else z={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(h=E=z,f=A):E=E.next=z,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;z=c,c=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(!0);E===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Gs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Xs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,gc(l,!1,t,e);try{var f=u(),h=p.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=wm(f,a);Su(l,t,E,St(l))}else Su(l,t,a,St(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},St())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=Sd(l).queue;gd(l,u,t,C,e===null?Pm:function(){return bd(l),e(a)})}function Sd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function bd(l){var t=Sd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},St())}function hc(){return Wl(xu)}function zd(){return Hl().memoizedState}function Ed(){return Hl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=St();l=Se(e);var a=be(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=St();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?Td(t,e):(e=Ri(l,t,e,a),e!==null&&(st(e,l,a),_d(e,t,a)))}function pd(l,t,e){var a=St();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))Td(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,rt(c,i))return an(l,t,u,0),gl===null&&en(),!1}catch{}if(e=Ri(l,t,u,a),e!==null)return st(e,l,a),_d(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:kc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Ri(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===$||t!==null&&t===$}function Td(l,t){ja=gn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function _d(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}var bu={readContext:Wl,use:zn,useCallback:jl,useContext:jl,useEffect:jl,useImperativeHandle:jl,useLayoutEffect:jl,useInsertionEffect:jl,useMemo:jl,useReducer:jl,useRef:jl,useState:jl,useDebugValue:jl,useDeferredValue:jl,useTransition:jl,useSyncExternalStore:jl,useId:jl,useHostTransitionStatus:jl,useFormState:jl,useActionState:jl,useOptimistic:jl,useMemoCache:jl,useCacheRefresh:jl};bu.useEffectEvent=jl;var Ad={readContext:Wl,use:zn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:fd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,pn(4194308,4,rd.bind(null,t,l),e)},useLayoutEffect:function(l,t){return pn(4194308,4,l,t)},useInsertionEffect:function(l,t){pn(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,$,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=pd.bind(null,$,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=tt();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=gd.bind(null,$,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=$,u=tt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),gl===null)throw Error(v(349));(el&127)!==0||Js(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,fd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Na(9,{destroy:void 0},ws.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=gl.identifierPrefix;if(ul){var e=Yt,a=Bt;e=(a&~(1<<32-ot(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Sn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return El(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=L.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Ko(l.nodeValue,e)),l||ye(t,!0)}else l=Ln(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return El(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;El(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return El(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;El(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),El(t),null);case 4:return bl(),l===null&&Pc(t.stateNode.containerInfo),El(t),null;case 10:return $t(t.type),El(t),null;case 19:if(r(Cl),a=t.memoizedState,a===null)return El(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)Eu(a,!1);else{if(Dl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=hn(l),n!==null){for(t.flags|=128,Eu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)ps(e,l),e=e.sibling;return O(Cl,Cl.current&1|2),ul&&Wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&J()>Rn&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304)}else{if(!u)if(l=hn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),Eu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return El(t),null}else 2*J()-a.renderingStartTime>Rn&&e!==536870912&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=J(),l.sibling=null,e=Cl.current,O(Cl,u?e&1|2:e&1),ul&&Wt(t,a.treeForkCount),l):(El(t),null);case 22:case 23:return yt(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(El(t),t.subtreeFlags&6&&(t.flags|=8192)):El(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&r(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),$t(xl),El(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return $t(xl),bl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(yt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return r(Cl),null;case 4:return bl(),null;case 10:return $t(t.type),null;case 22:case 23:return yt(t),lc(),l!==null&&r(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return $t(xl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:$t(xl),bl();break;case 26:case 27:case 5:pt(t);break;case 4:bl();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:r(Cl);break;case 10:$t(t.type);break;case 22:case 23:yt(t),lc(),l!==null&&r(Je);break;case 24:$t(xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){rl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(E){rl(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){rl(t,t.return,E)}}function $d(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Xs(t,e)}catch(a){rl(l,l.return,a)}}}function Fd(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){rl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){rl(l,t,u)}}function Gt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){rl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){rl(l,t,u)}else e.current=null}function Id(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){rl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[at]=t}catch(u){rl(l,l.return,u)}}function Pd(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function Hc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||Pd(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Rc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Rc(l,t,e),l=l.sibling;l!==null;)Rc(l,t,e),l=l.sibling}function Nn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Nn(l,t,e),l=l.sibling;l!==null;)Nn(l,t,e),l=l.sibling}function lo(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[at]=e}catch(n){rl(l,l.return,n)}}var te=!1,Yl=!1,xc=!1,to=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function cv(l,t){if(l=l.containerInfo,ef=Fn,l=ms(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,E=0,A=l,S=null;t:for(;;){for(var z;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(z=A.firstChild)!==null;)S=A,A=z;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++E===a&&(f=i),(z=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=z}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},Fn=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=fr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;chl&&(i=hl,hl=X,X=i);var o=os(c,X),s=os(c,hl);if(o&&s&&(z.rangeCount!==1||z.anchorNode!==o.node||z.anchorOffset!==o.offset||z.focusNode!==s.node||z.focusOffset!==s.offset)){var y=A.createRange();y.setStart(o.node,o.offset),z.removeAllRanges(),X>hl?(z.addRange(y),z.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),z.addRange(y))}}}}for(A=[],z=c;z=z.parentNode;)z.nodeType===1&&A.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Ql=0,xa=Oe=null,ie=0,(sl&6)!==0)throw Error(v(331));var c=sl;if(sl|=4,mo(n.current),so(n,n.current,i,e),sl=c,Du(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,p.T=a,Uo(l,t)}}function Ho(l,t,e){t=Mt(e,t),t=Ec(l.stateNode,t,2),l=be(l,t,2),l!==null&&(ka(l,2),Xt(l))}function rl(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Hd(2),a=be(t,e,2),a!==null&&(Rd(e,a,t,l),ka(a,2),Xt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,gl===l&&(el&e)===e&&(Dl===4||Dl===3&&(el&62914560)===el&&300>J()-Hn?(sl&2)===0&&qa(l,0):Gc|=e,Ra===el&&(Ra=0)),Xt(l)}function Ro(l,t){t===0&&(t=Mf()),l=Qe(l,t),l!==null&&(ka(l,t),Xt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Ro(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Ro(l,e)}function Sv(l,t){return La(l,t)}var Xn=null,Ya=null,wc=!1,Qn=!1,Wc=!1,je=0;function Xt(l){l!==Ya&&l.next===null&&(Ya===null?Xn=Ya=l:Ya=Ya.next=l),Qn=!0,wc||(wc=!0,zv())}function Du(l,t){if(!Wc&&Qn){Wc=!0;do for(var e=!1,a=Xn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-ot(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Yo(a,n))}else n=el,n=Lu(a,a===gl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||Wa(a,n)||(e=!0,Yo(a,n));a=a.next}while(e);Wc=!1}}function bv(){xo()}function xo(){Qn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=J(),e=null,a=Xn;a!==null;){var u=a.next,n=qo(a,t);n===0?(a.next=null,e===null?Xn=u:e.next=u,u===null&&(Ya=e)):(e=a,(l!==0||(n&3)!==0)&&(Qn=!0)),a=u}Ql!==0&&Ql!==5||Du(l),je!==0&&(je=0)}function qo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,A=f.initiatorType;E&&Jo(A)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function ur(l,t,e){var a=Ga;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ar.has(u)||(ar.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),ur("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),ur("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Ga;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Xa(l);break;case"script":n=Qa(l)}Ht.has(n)||(l=H({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Ga;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Qa(l)}if(!Ht.has(n)&&(l=H({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Ga;if(a&&l){var u=fa(a).hoistableStyles,n=Xa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=H({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&of(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(h,E){f.onload=h,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Jn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=H({src:l,async:!0},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=H({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function nr(l,t,e,a){var u=(u=L.current)?Kn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Xa(e.href),e=fa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Xa(e.href);var n=fa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qa(e),e=fa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Xa(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function ir(l){return H({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Qa(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function cr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=H({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),Jn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Xa(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=ir(e),(u=Ht.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,Jn(n,e.precedence,l),t.instance=n;case"script":return n=Qa(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=H({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Jn(a,e.precedence,l));return t.instance}function Jn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function dr(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function Wv(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Xa(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=ir(a),(u=Ht.get(u))&&of(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function kv(l,t){return l.stylesheets&&l.count===0&&$n(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$n(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var kn=null;function $n(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,kn=new Map,t.forEach($v,l),kn=null,Wn.call(l))}function $v(l,t){if(!(t.state.loading&4)){var e=kn.get(l);if(e)var a=e.get(null);else{e=new Map,kn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m)}catch(U){console.error(U)}}return m(),pf.exports=yy(),pf.exports}var gy=hy();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(m){const U=m.camera;if(_l.camera==="head")m.controls.target.set(0,10,0),U.position.set(10,12,18);else{m.controls.target.set(0,0,0);const M=48;_l.camera==="front"?U.position.set(0,0,M):_l.camera==="back"?U.position.set(0,0,-M):U.position.set(23,7,42)}U.lookAt(m.controls.target),U.updateProjectionMatrix(),m.controls.update()}function Yr(){_l.syncing=!0;try{_l.viewers.forEach(m=>Sy(m.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(m=>m.classList.toggle("active",m.dataset.camera===_l.camera))}function by(m){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:U}of _l.viewers)U!==m&&(U.camera.position.copy(m.camera.position),U.camera.quaternion.copy(m.camera.quaternion),U.camera.zoom=m.camera.zoom,U.controls.target.copy(m.controls.target),U.camera.updateProjectionMatrix(),U.controls.update())}finally{_l.syncing=!1}}}function zy(m,U,M){const v=m.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:m.querySelector("canvas"),width:m.clientWidth||220,height:m.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>by(D));const V=new ResizeObserver(()=>{!D.disposed&&m.clientWidth&&m.clientHeight&&(D.width=m.clientWidth,D.height=m.clientHeight)});V.observe(m),_l.viewers.push({viewer:D,observer:V}),Promise.resolve(D.loadSkin(U.url,{model:"default"})).then(()=>{M!==_l.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{M===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function Ey(m,U){zy(m,U,_l.generation),Yr();const M=_l.viewers.find(v=>v.viewer.canvas===m.querySelector("canvas"))||_l.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==M))}}function py(m,U,M){const v=_l.camera!==m;Object.assign(_l,{camera:m,outerLayer:U,uvOnly:M}),v&&Yr(),_l.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(U),D.renderPaused=M})}async function ii(m,U,M){const v=await fetch("/api/meat-model/"+m,U===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(U),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Gr=m=>["complete","failed"].includes(m);function Xr(m){const U={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取图像特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别 meat",complete:"已完成",failed:"失败"},M=m?.progress;return(U[m?.stage]||"正在预选")+(M?.fold?` · ${M.variant==="local"?"局部特征":"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[m,U]=Z.useState(null),[M,v]=Z.useState(""),[D,V]=Z.useState(!1),k=Z.useRef(!0),nl=Z.useRef(null),N=Z.useRef(!1),T=async()=>{try{const Y=await ii("status");k.current&&(U(Y),v(""))}catch(Y){k.current&&v(Y.message)}};Z.useEffect(()=>{k.current=!0,T();const Y=()=>T();return window.addEventListener("meat-saved",Y),nl.current=setInterval(T,1e4),()=>{k.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",Y)}},[]);const Q=m?.training&&!Gr(m.training.stage),H=async()=>{if(!N.current){N.current=!0,V(!0),v("");try{const Y=await ii("train",{});k.current&&U(ml=>({...ml,training:Y}))}catch(Y){k.current&&v(Y.message)}finally{N.current=!1,k.current&&(V(!1),T())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:m?.active?` ${m.active.id} · 已学习 ${m.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"仅在点击按钮时训练;保存标注不会自动更新模型。训练期间仍使用当前模型。"}),m?.dataset&&g.jsxs("p",{children:["当前可训练 ",m.dataset.count," 张 · 新增或修改 ",m.dataset.changed," 张",m.dataset.removed>0?` · 移除或失效 ${m.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:H,disabled:D||Q||!m?.active||m?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),m?.training&&g.jsxs("p",{role:"status",children:[Xr(m.training),m.training.stage==="complete"?" · 新模型已启用":"",m.training.error?`:${m.training.error}。原模型保持可用。`:""]}),m?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 IoU ",(m.active.metrics.iou*100).toFixed(1),"%;这不是新皮肤准确率,预选仍需人工检查。"]}),!!m?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[m.dataset.excluded.length," 张未纳入本轮训练"]}),m.dataset.excluded.map((Y,ml)=>g.jsxs("p",{children:[Y.id,":",Y.reason]},ml))]}),M&&g.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function Uy({data:m,disabled:U,onStart:M,onEnd:v,onApply:D}){const[V,k]=Z.useState(!1),[nl,N]=Z.useState(""),[T,Q]=Z.useState(""),H=Z.useRef(!0),Y=Z.useRef(null),ml=Z.useRef(!1);Z.useEffect(()=>(H.current=!0,()=>{H.current=!1,Y.current?.abort()}),[]);const Al=async()=>{if(ml.current)return;ml.current=!0,k(!0),Q(""),N("正在请求预选…"),M(),Y.current=new AbortController;const Nl=Y.current.signal;try{let K=await ii("predict",{key:m.key,skin_revision:m.skin_revision},Nl);for(;!Gr(K.stage);){if(!H.current||(N(Xr(K)),await new Promise(pl=>setTimeout(pl,1500)),!H.current))return;K=await ii("job?id="+encodeURIComponent(K.id),void 0,Nl)}if(K.stage==="failed")throw Error(K.error||"预选失败,请稍后重试");if(K.prediction.skin_revision!==m.skin_revision)throw Error("皮肤版本已变化,未应用预选");H.current&&(D(K.prediction),N(`预选来自 ${K.prediction.model_id} · ${K.prediction.selected.length} 格。请检查并修改,再保存。`))}catch(K){H.current&&K.name!=="AbortError"&&(Q(K.message),N(""))}finally{ml.current=!1,H.current&&(k(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:Al,disabled:U||V||m.model!=="classic",children:V?"模型预选中…":"模型预选"}),g.jsx("span",{children:m.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),nl&&g.jsx("p",{role:"status",children:nl}),T&&g.jsx("p",{role:"alert",className:"meat-warning",children:T})]})}const _y=Z.lazy(()=>Br(()=>import("./SkinEditor-VMsAFhH-.js"),__vite__mapDeps([0,1,2])).then(m=>({default:m.SkinEditor}))),Ay=Z.lazy(()=>Br(()=>import("./MeatEditor-C07kxdt0.js"),__vite__mapDeps([3,1]))),xe=m=>!!(m.best||m.rejection),ui=m=>m.model??m.folder,xr=m=>m==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(m,U)=>U==="all"||U==="perfect"&&!!m.perfect||U==="meat_pending"&&!!m.perfect&&m.meat_status!=="saved"||U==="meat_saved"&&!!m.perfect&&m.meat_status==="saved"||U==="best"&&!!m.best||U==="ordinary"&&!!m.best&&!m.perfect||m.rejection===U,qr=m=>m.version==="original"?"原版":m.version;async function ni(m,U){const M=await fetch(m,U===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(U)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function jy({result:m}){const U=Z.useRef(null);return Z.useEffect(()=>Ey(U.current,m),[m.url]),g.jsxs("div",{className:"skin-stage",ref:U,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[m,U]=Z.useState([]),[M,v]=Z.useState(null),[D,V]=Z.useState("pending"),[k,nl]=Z.useState("all"),[N,T]=Z.useState(""),[Q,H]=Z.useState(""),[Y,ml]=Z.useState(new Set),[Al,Nl]=Z.useState([]),[K,pl]=Z.useState(!1),[Gl,Xl]=Z.useState(null),[Fl,bt]=Z.useState("angle"),[Zl,P]=Z.useState(!0),[Ul,zt]=Z.useState(!1),[et,Kl]=Z.useState(null),[Ml,Et]=Z.useState(null),[Sl,Pl]=Z.useState(null),[p,j]=Z.useState(!1),C=Z.useRef(!1),fl=Z.useRef(null),dl=Z.useRef(null),d=Z.useRef(null),r=m.find(b=>b.key===M),O=(b,q=D,J=N,lt=Q,Ol=k)=>(!J||ui(b)===J)&&b.id.toLowerCase().includes(lt.trim().toLowerCase())&&(q==="all"||q==="pending"&&b.results.length>0&&!xe(b)||q==="done"&&xe(b)&&My(b,Ol)||q==="rejected"&&!!b.rejection||q==="no_results"&&!b.results.length),R=m.filter(b=>O(b)),w=r&&!R.includes(r)?[r,...R]:R,L=(b,q=!1)=>Xl({message:b,error:q}),I=(b,q=!0)=>{C.current||(q&&M&&M!==b&&Nl(J=>[...J,M]),v(b))},Rl=(b=D,q=N,J=Q,lt=Y)=>m.find(Ol=>O(Ol,b,q,J)&&!lt.has(Ol.key))?.key||null,bl=(b=m,q=Y)=>{const J=b.filter(Ol=>O(Ol)&&!q.has(Ol.key)&&Ol.key!==M),lt=b.findIndex(Ol=>Ol.key===M);I((J.find(Ol=>b.indexOf(Ol)>lt)||J[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,pl(!0);try{const q=await ni(b?"/api/refresh":"/api/state",b?{}:void 0);U(q.items),v(q.items.find(J=>J.key===M&&O(J))?.key||q.items.find(J=>O(J)&&!Y.has(J.key))?.key||null),b&&L("目录已刷新")}catch(q){L(q.message,!0)}finally{C.current=!1,pl(!1)}}}async function pt(b,q,J){if(!(C.current||!r)){C.current=!0,pl(!0);try{const lt=await ni("/api/"+b,{key:r.key,revision:r.revision,result:q?.name,reason:typeof q=="string"?q:void 0,png:J}),Ol=m.map(se=>se.key===M?lt.item:se);U(Ol);const Tt=new Set(Y);Tt.delete(M),ml(Tt),C.current=!1,Et(null),b!=="clear"&&bl(Ol,Tt),L(b==="clear"?"已撤销标注":"已保存 · "+r.id)}catch(lt){L(lt.message,!0)}finally{C.current=!1,pl(!1)}}}async function la(b=r){if(!(C.current||!b?.perfect)){C.current=!0,pl(!0);try{const q=await ni("/api/meat?key="+encodeURIComponent(b.key));j(!1),Pl(q)}catch(q){L(q.message,!0)}finally{C.current=!1,pl(!1)}}}const Va=()=>{C.current||p&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(Pl(null),j(!1))};async function Qt(b,q,J){if(!(C.current||!Sl)){C.current=!0,pl(!0);try{const lt=await ni("/api/meat",{key:Sl.key,revision:Sl.revision,skin_revision:Sl.skin_revision,meat_revision:Sl.meat_revision,selected:b,assistance:J});window.dispatchEvent(new Event("meat-saved"));const Ol=m.map(Tt=>Tt.key===Sl.key?lt.item:Tt);if(U(Ol),Pl(null),j(!1),L("meat 已保存 · "+Sl.id+" · "+b.length+" 格"),C.current=!1,q){const Tt=Ol.findIndex(Vt=>Vt.key===Sl.key),Ja=[...Ol.slice(Tt+1),...Ol.slice(0,Tt)].find(Vt=>Vt.perfect&&Vt.meat_status!=="saved"&&(!N||ui(Vt)===N)&&Vt.id.toLowerCase().includes(Q.trim().toLowerCase()));Ja?(I(Ja.key),await la(Ja)):L("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(lt){L(lt.message,!0)}finally{C.current=!1,pl(!1)}}}function ta(){if(C.current||!r)return;const b=new Set(Y);b.add(M),ml(b),bl(m,b)}function ea(){!C.current&&Al.length&&(v(Al.at(-1)),Nl(Al.slice(0,-1)))}Z.useEffect(()=>{fe()},[]),Z.useEffect(()=>py(Fl,Zl,Ul),[Fl,Zl,Ul,M]),Z.useEffect(()=>{if(!Gl)return;const b=setTimeout(()=>Xl(null),Gl.error?8e3:3500);return()=>clearTimeout(b)},[Gl]),Z.useEffect(()=>{et&&fl.current?.showModal()},[et]),Z.useEffect(()=>{Ml&&dl.current?.showModal()},[Ml]),Z.useEffect(()=>{Sl&&d.current?.showModal()},[Sl]),Z.useEffect(()=>{const b=q=>{if(!(K||et||Ml||Sl||q.ctrlKey||q.metaKey||q.altKey||q.target.closest("input,select,textarea,[contenteditable]"))){if(q.key.toLowerCase()==="s")q.preventDefault(),ta();else if(q.key==="ArrowLeft")q.preventDefault(),ea();else if(q.key==="ArrowRight")q.preventDefault(),bl();else if(/^[1-9]$/.test(q.key)){const J=r?.results[+q.key-1];J&&(q.preventDefault(),pt("choose",J))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Zt=m.filter(b=>!N||ui(b)===N),aa=Zt.filter(xe).length,ua=aa+Zt.filter(b=>b.results.length&&!xe(b)).length,La={done:Zt.filter(xe).length,pending:Zt.filter(b=>b.results.length&&!xe(b)).length,rejected:Zt.filter(b=>b.rejection).length,all:Zt.length,no_results:Zt.filter(b=>!b.results.length).length},Ka=b=>{C.current||(V(b),I(Rl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:K,onClick:()=>fe(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,q])=>g.jsxs("button",{"data-filter":b,disabled:K,className:D===b?"active":"",onClick:()=>Ka(b),children:[q," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:La[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:K,value:N,onChange:b=>{T(b.target.value),I(Rl(D,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(m.map(ui))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:K,value:Q,onChange:b=>{H(b.target.value),I(Rl(D,N,b.target.value))}})]}),D==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:K,value:k,onChange:b=>{const q=b.target.value;nl(q),I(m.find(J=>O(J,"done",N,Q,q)&&!Y.has(J.key))?.key||null)},children:Object.entries(Oy).map(([b,q])=>g.jsxs("option",{value:b,children:[q," ·"," ",m.filter(J=>O(J,"done",N,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(Ty,{}),g.jsx("main",{children:r?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:r.folder}),g.jsx("h2",{id:"itemId",children:r.id}),g.jsxs("p",{id:"itemInfo",children:[r.results.length," 个结果版本 ·"," ",r.annotation_conflict?"标注冲突,请重新选择":r.invalid_best||r.invalid_rejection?"标注已失效,请重新选择":r.perfect?"已选最佳(完美)":r.best?"已保存最佳结果":r.rejection?xr(r.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:K,value:M,onChange:b=>{const q=new Set(Y);q.delete(b.target.value),ml(q),I(b.target.value)},children:w.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":xe(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",r.source_url],["edited","中间图",r.edited_url]].map(([b,q,J])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",q]}),g.jsx("span",{children:b==="source"&&r.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!J,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:J,title:r.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:J||void 0,alt:q})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!J,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:K||!r.results.length||r.rejection==="result_unsatisfied",onClick:()=>pt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:K||!r.edited_url||r.rejection==="edited_unsatisfied",onClick:()=>pt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!xe(r)&&!r.invalid_best&&!r.invalid_rejection&&!r.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",r.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:r.rejection?xr(r.rejection):r.best||"原标注需要重新选择"}),r.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Kl({url:r.perfect_url,title:r.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),r.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:K,onClick:()=>la(),children:r.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),g.jsx("p",{className:"meat-status",children:r.meat_status==="saved"?`已标注 ${r.meat_count} 格 meat`:r.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:K,onClick:()=>pt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,q])=>g.jsx("button",{"data-camera":b,className:Fl===b?"active":"",onClick:()=>bt(b),children:q},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:b=>P(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Ul,onClick:()=>zt(!Ul),children:Ul?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Ul?" uv-only":""),children:[r.results.map((b,q)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(r.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:qr(b)}),g.jsx("span",{className:r.best===b.name?"chosen-badge":"version-number",children:r.best===b.name?r.perfect?"最佳 · 完美":"已选最佳":q+1})]}),g.jsx(jy,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Kl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:qr(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:K||r.best===b.name&&!r.perfect,onClick:()=>pt("choose",b),children:r.best===b.name&&!r.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:K||r.perfect===b.name&&!r.perfect_url,onClick:()=>pt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:K,onClick:()=>Et({result:b,url:r.perfect===b.name&&r.perfect_url?r.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},r.key+b.name)),!r.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:K,onClick:()=>{ml(new Set),V("pending"),T(""),H(""),I(Rl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:K||!Al.length,onClick:ea,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:K||!r,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",Y.size," 项 · 忽略不保存"]})]}),Gl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(Gl.error?" error":""),children:Gl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:fl,onCancel:()=>Kl(null),onClick:b=>{b.target===b.currentTarget&&Kl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:dl,onCancel:b=>{b.preventDefault(),K||Et(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:()=>Et(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),r?.edited_url?g.jsx("img",{src:r.edited_url,alt:`${r.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_y,{textureUrl:Ml.url,busy:K,onError:b=>L(b,!0),onSubmit:b=>pt("repair",Ml.result,b)})})})]}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]}),Sl&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),Va()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["meat 标注 · ",Sl.id," · ",Sl.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:Va,children:"关闭 ×"})]}),g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载 meat 标注器…"}),children:g.jsx(Ay,{data:Sl,busy:K,onSave:Qt,onDirty:j},Sl.key)}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]})]})}gy.createRoot(document.getElementById("root")).render(g.jsx(Dy,{}));export{Uy as M,Ny as R,Of as a,ry as b,cy as g,g as j,Z as r}; diff --git a/best_annotator/static/assets/index-Cch6ovWF.js b/best_annotator/static/assets/index-Cch6ovWF.js new file mode 100644 index 0000000000000000000000000000000000000000..2536878252161b2671c4fd7d4500df0d452e6785 --- /dev/null +++ b/best_annotator/static/assets/index-Cch6ovWF.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-DdoQReIT.js","assets/OrbitControls-fNwVPk9t.js","assets/SkinEditor-BzPsKcct.css","assets/MeatEditor-CJ5AMr9l.js"])))=>i.map(i=>d[i]); +(function(){const N=document.createElement("link").relList;if(N&&N.supports&&N.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const L of D)if(L.type==="childList")for(const $ of L.addedNodes)$.tagName==="LINK"&&$.rel==="modulepreload"&&v($)}).observe(document,{childList:!0,subtree:!0});function M(D){const L={};return D.integrity&&(L.integrity=D.integrity),D.referrerPolicy&&(L.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?L.credentials="include":D.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(D){if(D.ep)return;D.ep=!0;const L=M(D);fetch(D.href,L)}})();const n0="modulepreload",i0=function(o){return"/"+o},Ar={},Yr=function(N,M,v){let D=Promise.resolve();if(M&&M.length>0){let U=function(p){return Promise.all(p.map(Q=>Promise.resolve(Q).then(q=>({status:"fulfilled",value:q}),q=>({status:"rejected",reason:q}))))};document.getElementsByTagName("link");const $=document.querySelector("meta[property=csp-nonce]"),il=$?.nonce||$?.getAttribute("nonce");D=U(M.map(p=>{if(p=i0(p),p in Ar)return;Ar[p]=!0;const Q=p.endsWith(".css"),q=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${q}`))return;const H=document.createElement("link");if(H.rel=Q?"stylesheet":n0,Q||(H.as="script"),H.crossOrigin="",H.href=p,il&&H.setAttribute("nonce",il),document.head.appendChild(H),Q)return new Promise((ol,El)=>{H.addEventListener("load",ol),H.addEventListener("error",()=>El(new Error(`Unable to preload CSS for ${p}`)))})}))}function L($){const il=new Event("vite:preloadError",{cancelable:!0});if(il.payload=$,window.dispatchEvent(il),!il.defaultPrevented)throw $}return D.then($=>{for(const il of $||[])il.status==="rejected"&&L(il.reason);return N().catch(L)})};function c0(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var zf={exports:{}},Gu={};var Or;function f0(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.fragment");function M(v,D,L){var $=null;if(L!==void 0&&($=""+L),D.key!==void 0&&($=""+D.key),"key"in D){L={};for(var il in D)il!=="key"&&(L[il]=D[il])}else L=D;return D=L.ref,{$$typeof:o,type:v,key:$,ref:D!==void 0?D:null,props:L}}return Gu.Fragment=N,Gu.jsx=M,Gu.jsxs=M,Gu}var Mr;function s0(){return Mr||(Mr=1,zf.exports=f0()),zf.exports}var g=s0(),Ef={exports:{}},w={};var jr;function d0(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),$=Symbol.for("react.context"),il=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),H=Symbol.iterator;function ol(d){return d===null||typeof d!="object"?null:(d=H&&d[H]||d["@@iterator"],typeof d=="function"?d:null)}var El={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xl=Object.assign,al={};function ul(d,m,O){this.props=d,this.context=m,this.refs=al,this.updater=O||El}ul.prototype.isReactComponent={},ul.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},ul.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function yl(){}yl.prototype=ul.prototype;function Ul(d,m,O){this.props=d,this.context=m,this.refs=al,this.updater=O||El}var Vl=Ul.prototype=new yl;Vl.constructor=Ul,xl(Vl,ul.prototype),Vl.isPureReactComponent=!0;var tt=Array.isArray;function ql(){}var I={H:null,A:null,T:null,S:null},Cl=Object.prototype.hasOwnProperty;function Et(d,m,O){var R=O.ref;return{$$typeof:o,type:d,key:m,ref:R!==void 0?R:null,props:O}}function et(d,m){return Et(d.type,m,d.props)}function Jl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ml(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function bl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):m.toString(36)}function Pl(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(ql,ql):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function T(d,m,O,R,J){var V=typeof d;(V==="undefined"||V==="boolean")&&(d=null);var F=!1;if(d===null)F=!0;else switch(V){case"bigint":case"string":case"number":F=!0;break;case"object":switch(d.$$typeof){case o:case N:F=!0;break;case Q:return F=d._init,T(F(d._payload),m,O,R,J)}}if(F)return J=J(d),F=R===""?"."+bl(d,0):R,tt(J)?(O="",F!=null&&(O=F.replace(pt,"$&/")+"/"),T(J,m,O,"",function(fe){return fe})):J!=null&&(Jl(J)&&(J=et(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+F)),m.push(J)),1;F=0;var Bl=R===""?".":R+":";if(tt(d))for(var pl=0;pl>>1,rl=T[sl];if(0>>1;slD(O,C))RD(J,O)?(T[sl]=J,T[R]=C,sl=R):(T[sl]=O,T[m]=C,sl=m);else if(RD(J,C))T[sl]=J,T[R]=C,sl=R;else break l}}return j}function D(T,j){var C=T.sortIndex-j.sortIndex;return C!==0?C:T.id-j.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var $=Date,il=$.now();o.unstable_now=function(){return $.now()-il}}var U=[],p=[],Q=1,q=null,H=3,ol=!1,El=!1,xl=!1,al=!1,ul=typeof setTimeout=="function"?setTimeout:null,yl=typeof clearTimeout=="function"?clearTimeout:null,Ul=typeof setImmediate<"u"?setImmediate:null;function Vl(T){for(var j=M(p);j!==null;){if(j.callback===null)v(p);else if(j.startTime<=T)v(p),j.sortIndex=j.expirationTime,N(U,j);else break;j=M(p)}}function tt(T){if(xl=!1,Vl(T),!El)if(M(U)!==null)El=!0,ql||(ql=!0,Ml());else{var j=M(p);j!==null&&Pl(tt,j.startTime-T)}}var ql=!1,I=-1,Cl=5,Et=-1;function et(){return al?!0:!(o.unstable_now()-EtT&&et());){var sl=q.callback;if(typeof sl=="function"){q.callback=null,H=q.priorityLevel;var rl=sl(q.expirationTime<=T);if(T=o.unstable_now(),typeof rl=="function"){q.callback=rl,Vl(T),j=!0;break t}q===M(U)&&v(U),Vl(T)}else v(U);q=M(U)}if(q!==null)j=!0;else{var d=M(p);d!==null&&Pl(tt,d.startTime-T),j=!1}}break l}finally{q=null,H=C,ol=!1}j=void 0}}finally{j?Ml():ql=!1}}}var Ml;if(typeof Ul=="function")Ml=function(){Ul(Jl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,bl=pt.port2;pt.port1.onmessage=Jl,Ml=function(){bl.postMessage(null)}}else Ml=function(){ul(Jl,0)};function Pl(T,j){I=ul(function(){T(o.unstable_now())},j)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(T){T.callback=null},o.unstable_forceFrameRate=function(T){0>T||125sl?(T.sortIndex=C,N(p,T),M(U)===null&&T===M(p)&&(xl?(yl(I),I=-1):xl=!0,Pl(tt,C-sl))):(T.sortIndex=rl,N(U,T),El||ol||(El=!0,ql||(ql=!0,Ml()))),T},o.unstable_shouldYield=et,o.unstable_wrapCallback=function(T){var j=H;return function(){var C=H;H=j;try{return T.apply(this,arguments)}finally{H=C}}}})(_f)),_f}var Ur;function r0(){return Ur||(Ur=1,Tf.exports=o0()),Tf.exports}var Af={exports:{}},Il={};var Cr;function m0(){if(Cr)return Il;Cr=1;var o=Of();function N(U){var p="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),Af.exports=m0(),Af.exports}var Rr;function y0(){if(Rr)return Xu;Rr=1;var o=r0(),N=Of(),M=v0();function v(l){var t="https://react.dev/errors/"+l;if(1rl||(l.current=sl[rl],sl[rl]=null,rl--)}function O(l,t){rl++,sl[rl]=l.current,l.current=t}var R=d(null),J=d(null),V=d(null),F=d(null);function Bl(l,t){switch(O(V,t),O(J,l),O(R,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?$o(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=$o(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(R),O(R,l)}function pl(){m(R),m(J),m(V)}function fe(l){l.memoizedState!==null&&O(F,l);var t=R.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(R,e))}function Tt(l){J.current===l&&(m(R),m(J)),F.current===l&&(m(F),xu._currentValue=C)}var la,La;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",La=-1)":-1u||f[a]!==h[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Vt(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Zt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Vt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,Ka=o.unstable_scheduleCallback,Ja=o.unstable_cancelCallback,b=o.unstable_shouldYield,B=o.unstable_requestPaint,K=o.unstable_now,dt=o.unstable_getCurrentPriorityLevel,jl=o.unstable_ImmediatePriority,Rt=o.unstable_UserBlockingPriority,ot=o.unstable_NormalPriority,Mf=o.unstable_LowPriority,na=o.unstable_IdlePriority,se=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,rt=null;function de(l){if(typeof se=="function"&&Zr(l),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(wa,l)}catch{}}var mt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Qu=256,Zu=262144,Vu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Lu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function $a(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Vu;return Vu<<=1,(Vu&62914560)===0&&(Vu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&wu(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function oa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,zi=null,Wu=null;function $f(){if(Wu)return Wu;var l,t=zi,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ya=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ya)return l==="compositionend"||!Ai&&es(l,t)?(l=$f(),Wu=zi=re=null,ya=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=wu(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=wu(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ha=null,Di=null,iu=null,Ni=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ha==null||ha!==wu(a)||(a=ha,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Vn(Di,"onSelect"),0>=i,u-=i,Yt=1<<32-mt(t)+u|e<k?(el=Y,Y=null):el=Y.sibling;var fl=S(r,Y,y[k],_);if(fl===null){Y===null&&(Y=el);break}l&&Y&&fl.alternate===null&&t(r,Y),s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl,Y=el}if(k===y.length)return e(r,Y),nl&&$t(r,k),G;if(Y===null){for(;kk?(el=Y,Y=null):el=Y.sibling;var Re=S(r,Y,fl.value,_);if(Re===null){Y===null&&(Y=el);break}l&&Y&&Re.alternate===null&&t(r,Y),s=n(Re,s,k),cl===null?G=Re:cl.sibling=Re,cl=Re,Y=el}if(fl.done)return e(r,Y),nl&&$t(r,k),G;if(Y===null){for(;!fl.done;k++,fl=y.next())fl=A(r,fl.value,_),fl!==null&&(s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl);return nl&&$t(r,k),G}for(Y=a(Y);!fl.done;k++,fl=y.next())fl=z(Y,r,k,fl.value,_),fl!==null&&(l&&fl.alternate!==null&&Y.delete(fl.key===null?k:fl.key),s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl);return l&&Y.forEach(function(u0){return t(r,u0)}),nl&&$t(r,k),G}function Sl(r,s,y,_){if(typeof y=="object"&&y!==null&&y.type===xl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case ol:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===xl){if(s.tag===7){e(r,s.sibling),_=u(s,y.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Cl&&we(G)===s.type){e(r,s.sibling),_=u(s,y.props),ru(_,y),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}y.type===xl?(_=Ze(y.props.children,r.mode,_,y.key),_.return=r,r=_):(_=nn(y.type,y.key,y.props,null,r.mode,_),ru(_,y),_.return=r,r=_)}return i(r);case El:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(r,s.sibling),_=u(s,y.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Bi(y,r.mode,_),_.return=r,r=_}return i(r);case Cl:return y=we(y),Sl(r,s,y,_)}if(Pl(y))return x(r,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(r,s,y,_)}if(typeof y.then=="function")return Sl(r,s,mn(y),_);if(y.$$typeof===Ul)return Sl(r,s,sn(r,y),_);vn(r,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,y),_.return=r,r=_):(e(r,s),_=qi(y,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,y,_){try{ou=0;var G=Sl(r,s,y,_);return Ma=null,G}catch(Y){if(Y===Oa||Y===on)throw Y;var cl=yt(29,Y,null,r.mode);return cl.lanes=_,cl.return=r,cl}}}var We=Ys(!0),Gs=Ys(!1),ge=!1;function Wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=un(l),ps(l,null,e),t}return an(l,a,t,e),un(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=Aa;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=h:c.next=h,E.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,E=h=f=null,c=n;do{var S=c.lane&-536870913,z=S!==c.lane;if(z?(tl&S)===S:(a&S)===S){S!==0&&S===_a&&(Ii=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var x=l,X=c;S=t;var Sl=e;switch(X.tag){case 1:if(x=X.payload,typeof x=="function"){A=x.call(Sl,A,S);break l}A=x;break l;case 3:x.flags=x.flags&-65537|128;case 0:if(x=X.payload,S=typeof x=="function"?x.call(Sl,A,S):x,S==null)break l;A=q({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,z&&(l.flags|=8192),z=u.callbacks,z===null?u.callbacks=[S]:z.push(S))}else z={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(h=E=z,f=A):E=E.next=z,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;z=c,c=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(!0);E===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=T.T,c={};T.T=c,gc(l,!1,t,e);try{var f=u(),h=T.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=wm(f,a);Su(l,t,E,zt(l))}else Su(l,t,a,zt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},zt())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),T.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,C,e===null?Pm:function(){return zd(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function zd(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},zt())}function hc(){return Wl(xu)}function Ed(){return Rl().memoizedState}function pd(){return Rl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=zt();l=Se(e);var a=be(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=zt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?_d(t,e):(e=Ri(l,t,e,a),e!==null&&(st(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=zt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,vt(c,i))return an(l,t,u,0),zl===null&&en(),!1}catch{}if(e=Ri(l,t,u,a),e!==null)return st(e,l,a),Ad(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:Wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Ri(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Da=gn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:Wl,use:zn,useCallback:Dl,useContext:Dl,useEffect:Dl,useImperativeHandle:Dl,useLayoutEffect:Dl,useInsertionEffect:Dl,useMemo:Dl,useReducer:Dl,useRef:Dl,useState:Dl,useDebugValue:Dl,useDeferredValue:Dl,useTransition:Dl,useSyncExternalStore:Dl,useId:Dl,useHostTransitionStatus:Dl,useFormState:Dl,useActionState:Dl,useOptimistic:Dl,useMemoCache:Dl,useCacheRefresh:Dl};bu.useEffectEvent=Dl;var Od={readContext:Wl,use:zn,useCallback:function(l,t){return lt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,pn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return pn(4194308,4,l,t)},useInsertionEffect:function(l,t){pn(4,2,l,t)},useMemo:function(l,t){var e=lt();t=t===void 0?null:t;var a=l();if(ke){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=lt();if(e!==void 0){var u=e(t);if(ke){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=lt();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=lt();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),lt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=lt();if(nl){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),zl===null)throw Error(v(349));(tl&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Ua(9,{destroy:void 0},$s.bind(null,a,n,e,t),null),e},useId:function(){var l=lt(),t=zl.identifierPrefix;if(nl){var e=Gt,a=Yt;e=(a&~(1<<32-mt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Sn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[wl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch(Fl(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return _l(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=V.current,pa(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=$l,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[wl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ye(t,!0)}else l=Ln(l).createTextNode(a),l[wl]=t,t.stateNode=l}return _l(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=pa(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[wl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(gt(t),t):(gt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return _l(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=pa(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[wl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(gt(t),t):(gt(t),null)}return gt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),_l(t),null);case 4:return pl(),l===null&&Pc(t.stateNode.containerInfo),_l(t),null;case 10:return kt(t.type),_l(t),null;case 19:if(m(Hl),a=t.memoizedState,a===null)return _l(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)Eu(a,!1);else{if(Nl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=hn(l),n!==null){for(t.flags|=128,Eu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Hl,Hl.current&1|2),nl&&$t(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&K()>Rn&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304)}else{if(!u)if(l=hn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),Eu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!nl)return _l(t),null}else 2*K()-a.renderingStartTime>Rn&&e!==536870912&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=K(),l.sibling=null,e=Hl.current,O(Hl,u?e&1|2:e&1),nl&&$t(t,a.treeForkCount),l):(_l(t),null);case 22:case 23:return gt(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(_l(t),t.subtreeFlags&6&&(t.flags|=8192)):_l(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Yl),_l(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Yl),pl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(gt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(gt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Hl),null;case 4:return pl(),null;case 10:return kt(t.type),null;case 22:case 23:return gt(t),lc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Yl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:kt(Yl),pl();break;case 26:case 27:case 5:Tt(t);break;case 4:pl();break;case 31:t.memoizedState!==null&>(t);break;case 13:gt(t);break;case 19:m(Hl);break;case 10:kt(t.type);break;case 22:case 23:gt(t),lc(),l!==null&&m(Je);break;case 24:kt(Yl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){vl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(E){vl(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){vl(t,t.return,E)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){vl(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){vl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){vl(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){vl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){vl(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){vl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[at]=t}catch(u){vl(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function Hc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Rc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Rc(l,t,e),l=l.sibling;l!==null;)Rc(l,t,e),l=l.sibling}function Nn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Nn(l,t,e),l=l.sibling;l!==null;)Nn(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Fl(t,a,e),t[wl]=l,t[at]=e}catch(n){vl(l,l.return,n)}}var te=!1,Ql=!1,xc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Kl=null;function cv(l,t){if(l=l.containerInfo,ef=Fn,l=vs(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,E=0,A=l,S=null;t:for(;;){for(var z;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(z=A.firstChild)!==null;)S=A,A=z;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++E===a&&(f=i),(z=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=z}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},Fn=!1,Kl=t;Kl!==null;)if(t=Kl,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Kl=l;else for(;Kl!==null;){switch(t=Kl,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),Fl(n,a,e),n[wl]=l,Ll(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cSl&&(i=Sl,Sl=X,X=i);var r=rs(c,X),s=rs(c,Sl);if(r&&s&&(z.rangeCount!==1||z.anchorNode!==r.node||z.anchorOffset!==r.offset||z.focusNode!==s.node||z.focusOffset!==s.offset)){var y=A.createRange();y.setStart(r.node,r.offset),z.removeAllRanges(),X>Sl?(z.addRange(y),z.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),z.addRange(y))}}}}for(A=[],z=c;z=z.parentNode;)z.nodeType===1&&A.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,T.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Zl=0,qa=Oe=null,ie=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,T.T=a,Co(l,t)}}function Ro(l,t,e){t=Mt(e,t),t=Ec(l.stateNode,t,2),l=be(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function vl(l,t,e){if(l.tag===3)Ro(l,l,e);else for(;t!==null;){if(t.tag===3){Ro(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Rd(2),a=be(t,e,2),a!==null&&(xd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,zl===l&&(tl&e)===e&&(Nl===4||Nl===3&&(tl&62914560)===tl&&300>K()-Hn?(dl&2)===0&&Ba(l,0):Gc|=e,xa===tl&&(xa=0)),Qt(l)}function xo(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),xo(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),xo(l,e)}function Sv(l,t){return Ka(l,t)}var Xn=null,Ga=null,wc=!1,Qn=!1,$c=!1,je=0;function Qt(l){l!==Ga&&l.next===null&&(Ga===null?Xn=Ga=l:Ga=Ga.next=l),Qn=!0,wc||(wc=!0,zv())}function Du(l,t){if(!$c&&Qn){$c=!0;do for(var e=!1,a=Xn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-mt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=tl,n=Lu(a,a===zl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||$a(a,n)||(e=!0,Go(a,n));a=a.next}while(e);$c=!1}}function bv(){qo()}function qo(){Qn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=K(),e=null,a=Xn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Xn=u:e.next=u,u===null&&(Ga=e)):(e=a,(l!==0||(n&3)!==0)&&(Qn=!0)),a=u}Zl!==0&&Zl!==5||Du(l),je!==0&&(je=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,A=f.initiatorType;E&&wo(A)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function nr(l,t,e){var a=Xa;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Fl(t,"link",l),Ll(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Xa;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Qa(l);break;case"script":n=Za(l)}Ht.has(n)||(l=q({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),Fl(t,"link",l),Ll(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Xa;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Za(l)}if(!Ht.has(n)&&(l=q({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),Fl(a,"link",l),Ll(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Xa;if(a&&l){var u=sa(a).hoistableStyles,n=Qa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=q({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&of(l,e);var f=i=a.createElement("link");Ll(f),Fl(f,"link",l),f._p=new Promise(function(h,E){f.onload=h,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Jn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=q({src:l,async:!0},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Ll(n),Fl(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=q({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Ll(n),Fl(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=V.current)?Kn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Qa(e.href),e=sa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Qa(e.href);var n=sa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Za(e),e=sa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Qa(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return q({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Fl(t,"link",e),Ll(t),l.head.appendChild(t))}function Za(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Ll(a),a;var u=q({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Ll(a),Fl(a,"style",u),Jn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Qa(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Ll(n),n;a=cr(e),(u=Ht.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Ll(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Fl(n,"link",a),t.state.loading|=4,Jn(n,e.precedence,l),t.instance=n;case"script":return n=Za(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Ll(u),u):(a=e,(u=Ht.get(n))&&(a=q({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Ll(u),Fl(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Jn(a,e.precedence,l));return t.instance}function Jn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function $v(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Qa(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=$n.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Ll(n);return}n=t.ownerDocument||t,a=cr(a),(u=Ht.get(u))&&of(a,u),n=n.createElement("link"),Ll(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Fl(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=$n.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&kn(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function $n(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Wn=null;function kn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Wn=new Map,t.forEach(kv,l),Wn=null,$n.call(l))}function kv(l,t){if(!(t.state.loading&4)){var e=Wn.get(l);if(e)var a=e.get(null);else{e=new Map,Wn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),pf.exports=y0(),pf.exports}var g0=h0();const Ol={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function S0(o){const N=o.camera;if(Ol.camera==="head")o.controls.target.set(0,10,0),N.position.set(10,12,18);else{o.controls.target.set(0,0,0);const M=48;Ol.camera==="front"?N.position.set(0,0,M):Ol.camera==="back"?N.position.set(0,0,-M):N.position.set(23,7,42)}N.lookAt(o.controls.target),N.updateProjectionMatrix(),o.controls.update()}function Gr(){Ol.syncing=!0;try{Ol.viewers.forEach(o=>S0(o.viewer))}finally{Ol.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===Ol.camera))}function b0(o){if(!Ol.syncing){Ol.syncing=!0;try{for(const{viewer:N}of Ol.viewers)N!==o&&(N.camera.position.copy(o.camera.position),N.camera.quaternion.copy(o.camera.quaternion),N.camera.zoom=o.camera.zoom,N.controls.target.copy(o.controls.target),N.camera.updateProjectionMatrix(),N.controls.update())}finally{Ol.syncing=!1}}}function z0(o,N,M){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:Ol.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>b0(D));const L=new ResizeObserver(()=>{!D.disposed&&o.clientWidth&&o.clientHeight&&(D.width=o.clientWidth,D.height=o.clientHeight)});L.observe(o),Ol.viewers.push({viewer:D,observer:L}),Promise.resolve(D.loadSkin(N.url,{model:"default"})).then(()=>{M!==Ol.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(Ol.outerLayer),v.hidden=!0)}).catch(()=>{M===Ol.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function E0(o,N){z0(o,N,Ol.generation),Gr();const M=Ol.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||Ol.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),Ol.viewers=Ol.viewers.filter(v=>v!==M))}}function p0(o,N,M){const v=Ol.camera!==o;Object.assign(Ol,{camera:o,outerLayer:N,uvOnly:M}),v&&Gr(),Ol.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(N),D.renderPaused=M})}async function ii(o,N,M){const v=await fetch("/api/meat-model/"+o,N===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const N={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别五类标注",complete:"已完成",failed:"失败"},M=o?.progress;return(N[o?.stage]||"正在预选")+(M?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型",surface_control:"旧结构对照",face_v8:"面部解码器"}[M.variant]||"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function T0(){const[o,N]=Z.useState(null),[M,v]=Z.useState(""),[D,L]=Z.useState(!1),$=Z.useRef(!0),il=Z.useRef(null),U=Z.useRef(!1),p=async()=>{try{const H=await ii("status");$.current&&(N(H),v(""))}catch(H){$.current&&v(H.message)}};Z.useEffect(()=>{$.current=!0,p();const H=()=>p();return window.addEventListener("meat-saved",H),il.current=setInterval(p,1e4),()=>{$.current=!1,clearInterval(il.current),window.removeEventListener("meat-saved",H)}},[]);const Q=o?.training&&!Xr(o.training.stage),q=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const H=await ii("train",{});$.current&&N(ol=>({...ol,training:H}))}catch(H){$.current&&v(H.message)}finally{U.current=!1,$.current&&(L(!1),p())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"预选包含裸露皮肤、眼睛、嘴巴、眉毛和胡子。仅在点击训练按钮时更新模型;保存标注不会自动训练。已保存的细分类参与训练,未细标格仍用于二分类。"}),o?.dataset&&g.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:q,disabled:D||Q||!o?.active||o?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:p,children:"刷新模型状态"})]}),o?.training&&g.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?o.training.promoted===!1?" · 候选已完成,尚未替换当前模型":" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 · meat 二分类 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是五类准确率或新皮肤准确率,预选仍需人工检查。"]}),o?.active?.fine_metrics&&g.jsxs("p",{children:["已知细标的留出召回:",Object.entries({1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"}).map(([H,ol])=>`${ol} ${((o.active.fine_metrics[H]?.recall||0)*100).toFixed(1)}%`).join(" · "),"。细标含人工与助手来源。"]}),!!o?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((H,ol)=>g.jsxs("p",{children:[H.id,":",H.reason]},ol))]}),M&&g.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function U0({data:o,disabled:N,onStart:M,onEnd:v,onApply:D,hint:L}){const[$,il]=Z.useState(!1),[U,p]=Z.useState(""),[Q,q]=Z.useState(""),H=Z.useRef(!0),ol=Z.useRef(null),El=Z.useRef(!1);Z.useEffect(()=>(H.current=!0,()=>{H.current=!1,ol.current?.abort()}),[]);const xl=async()=>{if(El.current)return;El.current=!0,il(!0),q(""),p("正在请求预选…"),M(),ol.current=new AbortController;const al=ol.current.signal;try{let ul=await ii("predict",{key:o.key,skin_revision:o.skin_revision},al);for(;!Xr(ul.stage);){if(!H.current||(p(Qr(ul)),await new Promise(yl=>setTimeout(yl,1500)),!H.current))return;ul=await ii("job?id="+encodeURIComponent(ul.id),void 0,al)}if(ul.stage==="failed")throw Error(ul.error||"预选失败,请稍后重试");if(ul.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");if(H.current){D(ul.prediction);const yl=ul.prediction,Ul={1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"},Vl=yl.semantic_available?Object.entries(Ul).map(([tt,ql])=>`${ql} ${yl.category_counts?.[tt]||0} 格`).join(" · "):`${yl.selected.length} 格 meat(当前旧模型仅支持二分类,已有细分类保留)`;p(`预选来自 ${yl.model_id} · ${Vl}${yl.uncertain_count?` · ${yl.uncertain_count} 格不确定,已保持未选,请复核`:""}。切换类别查看高亮;请检查并修改,再保存。`)}}catch(ul){H.current&&ul.name!=="AbortError"&&(q(ul.message),p(""))}finally{El.current=!1,H.current&&(il(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:xl,disabled:N||$||o.model!=="classic",children:$?"五类预选中…":"模型预选五类"}),g.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":L||"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),U&&g.jsx("p",{role:"status",children:U}),Q&&g.jsx("p",{role:"alert",className:"meat-warning",children:Q})]})}const _0=Z.lazy(()=>Yr(()=>import("./SkinEditor-DdoQReIT.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),A0=Z.lazy(()=>Yr(()=>import("./MeatEditor-CJ5AMr9l.js"),__vite__mapDeps([3,1]))),xe=o=>!!(o.best||o.rejection),ui=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",O0={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},M0=(o,N)=>N==="all"||N==="perfect"&&!!o.perfect||N==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||N==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||N==="best"&&!!o.best||N==="ordinary"&&!!o.best&&!o.perfect||o.rejection===N,Br=o=>o.version==="original"?"原版":o.version;async function ni(o,N){const M=await fetch(o,N===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function j0({result:o}){const N=Z.useRef(null);return Z.useEffect(()=>E0(N.current,o),[o.url]),g.jsxs("div",{className:"skin-stage",ref:N,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function D0(){const[o,N]=Z.useState([]),[M,v]=Z.useState(null),[D,L]=Z.useState("pending"),[$,il]=Z.useState("all"),[U,p]=Z.useState(""),[Q,q]=Z.useState(""),[H,ol]=Z.useState(new Set),[El,xl]=Z.useState([]),[al,ul]=Z.useState(!1),[yl,Ul]=Z.useState(null),[Vl,tt]=Z.useState("angle"),[ql,I]=Z.useState(!0),[Cl,Et]=Z.useState(!1),[et,Jl]=Z.useState(null),[Ml,pt]=Z.useState(null),[bl,Pl]=Z.useState(null),[T,j]=Z.useState(!1),C=Z.useRef(!1),sl=Z.useRef(null),rl=Z.useRef(null),d=Z.useRef(null),m=o.find(b=>b.key===M),O=(b,B=D,K=U,dt=Q,jl=$)=>(!K||ui(b)===K)&&b.id.toLowerCase().includes(dt.trim().toLowerCase())&&(B==="all"||B==="pending"&&b.results.length>0&&!xe(b)||B==="done"&&xe(b)&&M0(b,jl)||B==="rejected"&&!!b.rejection||B==="no_results"&&!b.results.length),R=o.filter(b=>O(b)),J=m&&!R.includes(m)?[m,...R]:R,V=(b,B=!1)=>Ul({message:b,error:B}),F=(b,B=!0)=>{C.current||(B&&M&&M!==b&&xl(K=>[...K,M]),v(b))},Bl=(b=D,B=U,K=Q,dt=H)=>o.find(jl=>O(jl,b,B,K)&&!dt.has(jl.key))?.key||null,pl=(b=o,B=H)=>{const K=b.filter(jl=>O(jl)&&!B.has(jl.key)&&jl.key!==M),dt=b.findIndex(jl=>jl.key===M);F((K.find(jl=>b.indexOf(jl)>dt)||K[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,ul(!0);try{const B=await ni(b?"/api/refresh":"/api/state",b?{}:void 0);N(B.items),v(B.items.find(K=>K.key===M&&O(K))?.key||B.items.find(K=>O(K)&&!H.has(K.key))?.key||null),b&&V("目录已刷新")}catch(B){V(B.message,!0)}finally{C.current=!1,ul(!1)}}}async function Tt(b,B,K){if(!(C.current||!m)){C.current=!0,ul(!0);try{const dt=await ni("/api/"+b,{key:m.key,revision:m.revision,result:B?.name,reason:typeof B=="string"?B:void 0,png:K}),jl=o.map(ot=>ot.key===M?dt.item:ot);N(jl);const Rt=new Set(H);Rt.delete(M),ol(Rt),C.current=!1,pt(null),b!=="clear"&&pl(jl,Rt),V(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(dt){V(dt.message,!0)}finally{C.current=!1,ul(!1)}}}async function la(b=m){if(!(C.current||!b?.perfect)){C.current=!0,ul(!0);try{const B=await ni("/api/meat-labels?key="+encodeURIComponent(b.key));j(!1),Pl(B)}catch(B){V(B.message,!0)}finally{C.current=!1,ul(!1)}}}const La=()=>{C.current||T&&!window.confirm("分类标注尚未保存,放弃本次修改?")||(Pl(null),j(!1))};async function Zt(b,B,K,dt=!1){if(!(C.current||!bl)){C.current=!0,ul(!0);try{const jl=await ni("/api/meat-labels",{key:bl.key,revision:bl.revision,skin_revision:bl.skin_revision,meat_revision:bl.meat_revision,semantic_revision:bl.semantic.semantic_revision,labels:b,assistance:K,fine_review_complete:dt});window.dispatchEvent(new Event("meat-saved"));const Rt=o.map(ot=>ot.key===bl.key?jl.item:ot);if(N(Rt),Pl(null),j(!1),V("分类已保存 · "+bl.id+" · "+b.filter(Boolean).length+" 格"),C.current=!1,B){const ot=Rt.findIndex(se=>se.key===bl.key),na=[...Rt.slice(ot+1),...Rt.slice(0,ot)].find(se=>se.perfect&&se.meat_status!=="saved"&&(!U||ui(se)===U)&&se.id.toLowerCase().includes(Q.trim().toLowerCase()));na?(F(na.key),await la(na)):V("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(jl){V(jl.message,!0)}finally{C.current=!1,ul(!1)}}}function ta(){if(C.current||!m)return;const b=new Set(H);b.add(M),ol(b),pl(o,b)}function ea(){!C.current&&El.length&&(v(El.at(-1)),xl(El.slice(0,-1)))}Z.useEffect(()=>{fe()},[]),Z.useEffect(()=>p0(Vl,ql,Cl),[Vl,ql,Cl,M]),Z.useEffect(()=>{if(!yl)return;const b=setTimeout(()=>Ul(null),yl.error?8e3:3500);return()=>clearTimeout(b)},[yl]),Z.useEffect(()=>{et&&sl.current?.showModal()},[et]),Z.useEffect(()=>{Ml&&rl.current?.showModal()},[Ml]),Z.useEffect(()=>{bl&&d.current?.showModal()},[bl]),Z.useEffect(()=>{const b=B=>{if(!(al||et||Ml||bl||B.ctrlKey||B.metaKey||B.altKey||B.target.closest("input,select,textarea,[contenteditable]"))){if(B.key.toLowerCase()==="s")B.preventDefault(),ta();else if(B.key==="ArrowLeft")B.preventDefault(),ea();else if(B.key==="ArrowRight")B.preventDefault(),pl();else if(/^[1-9]$/.test(B.key)){const K=m?.results[+B.key-1];K&&(B.preventDefault(),Tt("choose",K))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Vt=o.filter(b=>!U||ui(b)===U),aa=Vt.filter(xe).length,ua=aa+Vt.filter(b=>b.results.length&&!xe(b)).length,Ka={done:Vt.filter(xe).length,pending:Vt.filter(b=>b.results.length&&!xe(b)).length,rejected:Vt.filter(b=>b.rejection).length,all:Vt.length,no_results:Vt.filter(b=>!b.results.length).length},Ja=b=>{C.current||(L(b),F(Bl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:al,onClick:()=>fe(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,B])=>g.jsxs("button",{"data-filter":b,disabled:al,className:D===b?"active":"",onClick:()=>Ja(b),children:[B," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:al,value:U,onChange:b=>{p(b.target.value),F(Bl(D,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ui))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:al,value:Q,onChange:b=>{q(b.target.value),F(Bl(D,U,b.target.value))}})]}),D==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:al,value:$,onChange:b=>{const B=b.target.value;il(B),F(o.find(K=>O(K,"done",U,Q,B)&&!H.has(K.key))?.key||null)},children:Object.entries(O0).map(([b,B])=>g.jsxs("option",{value:b,children:[B," ·"," ",o.filter(K=>O(K,"done",U,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(T0,{}),g.jsx("main",{children:m?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:m.folder}),g.jsx("h2",{id:"itemId",children:m.id}),g.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:al,value:M,onChange:b=>{const B=new Set(H);B.delete(b.target.value),ol(B),F(b.target.value)},children:J.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":xe(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,B,K])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",B]}),g.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!K,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Jl({url:K,title:m.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:K||void 0,alt:B})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!K,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:al||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:al||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!xe(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Jl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:al,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑分类":"标注皮肤分类"}),g.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:al,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,B])=>g.jsx("button",{"data-camera":b,className:Vl===b?"active":"",onClick:()=>tt(b),children:B},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:ql,onChange:b=>I(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Cl,onClick:()=>Et(!Cl),children:Cl?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Cl?" uv-only":""),children:[m.results.map((b,B)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:Br(b)}),g.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":B+1})]}),g.jsx(j0,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Jl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:al||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:al||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:al,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:al,onClick:()=>{ol(new Set),L("pending"),p(""),q(""),F(Bl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:al||!El.length,onClick:ea,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:al||!m,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",H.size," 项 · 忽略不保存"]})]}),yl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(yl.error?" error":""),children:yl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>Jl(null),onClick:b=>{b.target===b.currentTarget&&Jl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Jl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:rl,onCancel:b=>{b.preventDefault(),al||pt(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:al,onClick:()=>pt(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?g.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_0,{textureUrl:Ml.url,busy:al,onError:b=>V(b,!0),onSubmit:b=>Tt("repair",Ml.result,b)})})})]}),yl?.error&&g.jsx("p",{role:"alert",children:yl.message})]}),bl&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),La()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["皮肤分类 · ",bl.id," · ",bl.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:al,onClick:La,children:"关闭 ×"})]}),g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载分类标注器…"}),children:g.jsx(A0,{data:bl,busy:al,onSave:Zt,onDirty:j},bl.key)}),yl?.error&&g.jsx("p",{role:"alert",children:yl.message})]})]})}g0.createRoot(document.getElementById("root")).render(g.jsx(D0,{}));export{U0 as M,N0 as R,Of as a,r0 as b,c0 as g,g as j,Z as r}; diff --git a/best_annotator/static/assets/index-Cwjw6kcd.js b/best_annotator/static/assets/index-Cwjw6kcd.js new file mode 100644 index 0000000000000000000000000000000000000000..1719c8aad89a39bf6a5b7a9ecf21b21d08cf3dd7 --- /dev/null +++ b/best_annotator/static/assets/index-Cwjw6kcd.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-B3e0be2n.js","assets/OrbitControls-D8dMCyiM.js","assets/SkinEditor-BsOaSug0.css","assets/MeatEditor-BnFhxK7E.js"])))=>i.map(i=>d[i]); +(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const N of document.querySelectorAll('link[rel="modulepreload"]'))v(N);new MutationObserver(N=>{for(const L of N)if(L.type==="childList")for(const k of L.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&v(k)}).observe(document,{childList:!0,subtree:!0});function j(N){const L={};return N.integrity&&(L.integrity=N.integrity),N.referrerPolicy&&(L.referrerPolicy=N.referrerPolicy),N.crossOrigin==="use-credentials"?L.credentials="include":N.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(N){if(N.ep)return;N.ep=!0;const L=j(N);fetch(N.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(C,j,v){let N=Promise.resolve();if(j&&j.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),nl=k?.nonce||k?.getAttribute("nonce");N=U(j.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const Y=document.createElement("link");if(Y.rel=Q?"stylesheet":ny,Q||(Y.as="script"),Y.crossOrigin="",Y.href=T,nl&&Y.setAttribute("nonce",nl),document.head.appendChild(Y),Q)return new Promise((vl,Al)=>{Y.addEventListener("load",vl),Y.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function L(k){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=k,window.dispatchEvent(nl),!nl.defaultPrevented)throw k}return N.then(k=>{for(const nl of k||[])nl.status==="rejected"&&L(nl.reason);return C().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var zf={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function j(v,N,L){var k=null;if(L!==void 0&&(k=""+L),N.key!==void 0&&(k=""+N.key),"key"in N){L={};for(var nl in N)nl!=="key"&&(L[nl]=N[nl])}else L=N;return N=L.ref,{$$typeof:o,type:v,key:k,ref:N!==void 0?N:null,props:L}}return Gu.Fragment=C,Gu.jsx=j,Gu.jsxs=j,Gu}var Mr;function sy(){return Mr||(Mr=1,zf.exports=fy()),zf.exports}var g=sy(),pf={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),k=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),Y=Symbol.iterator;function vl(d){return d===null||typeof d!="object"?null:(d=Y&&d[Y]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,K={};function bl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}bl.prototype.isReactComponent={},bl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},bl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Gl(){}Gl.prototype=bl.prototype;function Xl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}var Fl=Xl.prototype=new Gl;Fl.constructor=Xl,Nl(Fl,bl.prototype),Fl.isPureReactComponent=!0;var Et=Array.isArray;function Zl(){}var I={H:null,A:null,T:null,S:null},Ul=Object.prototype.hasOwnProperty;function zt(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function et(d,m){return zt(d.type,m,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ml(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function il(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):m.toString(36)}function Il(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var Z=typeof d;(Z==="undefined"||Z==="boolean")&&(d=null);var F=!1;if(d===null)F=!0;else switch(Z){case"bigint":case"string":case"number":F=!0;break;case"object":switch(d.$$typeof){case o:case C:F=!0;break;case Q:return F=d._init,p(F(d._payload),m,O,x,J)}}if(F)return J=J(d),F=x===""?"."+il(d,0):x,Et(J)?(O="",F!=null&&(O=F.replace(pt,"$&/")+"/"),p(J,m,O,"",function(ce){return ce})):J!=null&&(Kl(J)&&(J=et(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+F)),m.push(J)),1;F=0;var Rl=x===""?".":x+":";if(Et(d))for(var El=0;El>>1,ol=p[sl];if(0>>1;slN(O,H))xN(J,O)?(p[sl]=J,p[x]=H,sl=x):(p[sl]=O,p[m]=H,sl=m);else if(xN(J,H))p[sl]=J,p[x]=H,sl=x;else break l}}return M}function N(p,M){var H=p.sortIndex-M.sortIndex;return H!==0?H:p.id-M.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var k=Date,nl=k.now();o.unstable_now=function(){return k.now()-nl}}var U=[],T=[],Q=1,R=null,Y=3,vl=!1,Al=!1,Nl=!1,K=!1,bl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,Xl=typeof setImmediate<"u"?setImmediate:null;function Fl(p){for(var M=j(T);M!==null;){if(M.callback===null)v(T);else if(M.startTime<=p)v(T),M.sortIndex=M.expirationTime,C(U,M);else break;M=j(T)}}function Et(p){if(Nl=!1,Fl(p),!Al)if(j(U)!==null)Al=!0,Zl||(Zl=!0,Ml());else{var M=j(T);M!==null&&Il(Et,M.startTime-p)}}var Zl=!1,I=-1,Ul=5,zt=-1;function et(){return K?!0:!(o.unstable_now()-ztp&&et());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,Y=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,Fl(p),M=!0;break t}R===j(U)&&v(U),Fl(p)}else v(U);R=j(U)}if(R!==null)M=!0;else{var d=j(T);d!==null&&Il(Et,d.startTime-p),M=!1}}break l}finally{R=null,Y=H,vl=!1}M=void 0}}finally{M?Ml():Zl=!1}}}var Ml;if(typeof Xl=="function")Ml=function(){Xl(Kl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,il=pt.port2;pt.port1.onmessage=Kl,Ml=function(){il.postMessage(null)}}else Ml=function(){bl(Kl,0)};function Il(p,M){I=bl(function(){p(o.unstable_now())},M)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=H,C(T,p),j(U)===null&&p===j(T)&&(Nl?(Gl(I),I=-1):Nl=!0,Il(Et,H-sl))):(p.sortIndex=ol,C(U,p),Al||vl||(Al=!0,Zl||(Zl=!0,Ml()))),p},o.unstable_shouldYield=et,o.unstable_wrapCallback=function(p){var M=Y;return function(){var H=Y;Y=M;try{return p.apply(this,arguments)}finally{Y=H}}}})(Af)),Af}var Ur;function ry(){return Ur||(Ur=1,_f.exports=oy()),_f.exports}var Of={exports:{}},lt={};var Cr;function my(){if(Cr)return lt;Cr=1;var o=Mf();function C(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Of.exports=my(),Of.exports}var Rr;function yy(){if(Rr)return Xu;Rr=1;var o=ry(),C=Mf(),j=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),Z=d(null),F=d(null);function Rl(l,t){switch(O(Z,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?ko(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=ko(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function El(){m(x),m(J),m(Z)}function ce(l){l.memoizedState!==null&&O(F,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),F.current===l&&(m(F),xu._currentValue=H)}var la,Va;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==h[u]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=u);break}}}finally{La=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Qu(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ta(l.type,!1);case 11:return ta(l.type.render,!1);case 1:return ta(l.type,!0);case 31:return Zt("Activity");default:return""}}function Bt(l){try{var t="",e=null;do t+=Qu(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var xe=Object.prototype.hasOwnProperty,ea=o.unstable_scheduleCallback,Ka=o.unstable_cancelCallback,ci=o.unstable_shouldYield,b=o.unstable_requestPaint,D=o.unstable_now,tl=o.unstable_getCurrentPriorityLevel,Pl=o.unstable_ImmediatePriority,Ol=o.unstable_UserBlockingPriority,at=o.unstable_NormalPriority,Ja=o.unstable_LowPriority,aa=o.unstable_IdlePriority,fe=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,ot=null;function se(l){if(typeof fe=="function"&&Zr(l),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(wa,l)}catch{}}var rt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Zu=256,Vu=262144,Lu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ku(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function ka(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Lu;return Lu<<=1,(Lu&62914560)===0&&(Lu=4194304),l}function fi(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?yi(l,i,_t(t)):e!=null?yi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){mi(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),mi(l)}function yi(l,t,e){t==="number"&&ku(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function sa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(Kt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{Ei=!1}var oe=null,zi=null,$u=null;function kf(){if($u)return $u;var l,t=zi,e=t.length,a,u="value"in oe?oe.value:oe.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ma=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ma)return l==="compositionend"||!Oi&&es(l,t)?(l=kf(),$u=zi=oe=null,ma=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=ku(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=ku(l.document)}return t}function Di(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Kt&&"documentMode"in document&&11>=document.documentMode,va=null,Ni=null,iu=null,Ui=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ui||va==null||va!==ku(a)||(a=va,"selectionStart"in a&&Di(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Ln(Ni,"onSelect"),0>=i,u-=i,Yt=1<<32-rt(t)+u|e<$?(al=B,B=null):al=B.sibling;var fl=S(r,B,y[$],_);if(fl===null){B===null&&(B=al);break}l&&B&&fl.alternate===null&&t(r,B),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl,B=al}if($===y.length)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;$$?(al=B,B=null):al=B.sibling;var He=S(r,B,fl.value,_);if(He===null){B===null&&(B=al);break}l&&B&&He.alternate===null&&t(r,B),s=n(He,s,$),cl===null?G=He:cl.sibling=He,cl=He,B=al}if(fl.done)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;!fl.done;$++,fl=y.next())fl=A(r,fl.value,_),fl!==null&&(s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return ul&&wt(r,$),G}for(B=a(B);!fl.done;$++,fl=y.next())fl=E(B,r,$,fl.value,_),fl!==null&&(l&&fl.alternate!==null&&B.delete(fl.key===null?$:fl.key),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return l&&B.forEach(function(uy){return t(r,uy)}),ul&&wt(r,$),G}function gl(r,s,y,_){if(typeof y=="object"&&y!==null&&y.type===Nl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case vl:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===Nl){if(s.tag===7){e(r,s.sibling),_=u(s,y.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ul&&we(G)===s.type){e(r,s.sibling),_=u(s,y.props),ru(_,y),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}y.type===Nl?(_=Ze(y.props.children,r.mode,_,y.key),_.return=r,r=_):(_=cn(y.type,y.key,y.props,null,r.mode,_),ru(_,y),_.return=r,r=_)}return i(r);case Al:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(r,s.sibling),_=u(s,y.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Yi(y,r.mode,_),_.return=r,r=_}return i(r);case Ul:return y=we(y),gl(r,s,y,_)}if(Il(y))return q(r,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(r,s,y,_)}if(typeof y.then=="function")return gl(r,s,vn(y),_);if(y.$$typeof===Xl)return gl(r,s,dn(r,y),_);yn(r,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,y),_.return=r,r=_):(e(r,s),_=Bi(y,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,y,_){try{ou=0;var G=gl(r,s,y,_);return Aa=null,G}catch(B){if(B===_a||B===rn)throw B;var cl=vt(29,B,null,r.mode);return cl.lanes=_,cl.return=r,cl}}}var We=Ys(!0),Gs=Ys(!1),he=!1;function $i(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fi(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ge(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Se(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=nn(l),ps(l,null,e),t}return un(l,a,t,e),nn(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Ii(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Pi=!1;function vu(){if(Pi){var l=Ta;if(l!==null)throw l}}function yu(l,t,e,a){Pi=!1;var u=l.updateQueue;he=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var z=l.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=h:c.next=h,z.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,z=h=f=null,c=n;do{var S=c.lane&-536870913,E=S!==c.lane;if(E?(el&S)===S:(a&S)===S){S!==0&&S===pa&&(Pi=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var q=l,X=c;S=t;var gl=e;switch(X.tag){case 1:if(q=X.payload,typeof q=="function"){A=q.call(gl,A,S);break l}A=q;break l;case 3:q.flags=q.flags&-65537|128;case 0:if(q=X.payload,S=typeof q=="function"?q.call(gl,A,S):q,S==null)break l;A=R({},A,S);break l;case 2:he=!0}}S=c.callback,S!==null&&(l.flags|=64,E&&(l.flags|=8192),E=u.callbacks,E===null?u.callbacks=[S]:E.push(S))}else E={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(h=z=E,f=A):z=z.next=E,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;E=c,c=E.next,E.next=null,u.lastBaseUpdate=E,u.shared.pending=null}}while(!0);z===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=z,n===null&&(u.shared.lanes=0),Te|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,Sc(l,!1,t,e);try{var f=u(),h=p.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=wm(f,a);Su(l,t,z,bt(l))}else Su(l,t,a,bt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},bt())}finally{M.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function hc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,H,e===null?Pm:function(){return Ed(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:H},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Ed(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},bt())}function gc(){return kl(xu)}function zd(){return Hl().memoizedState}function pd(){return Hl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=bt();l=ge(e);var a=Se(t,l,e);a!==null&&(dt(a,t,e),mu(a,t,e)),t={cache:Ji()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=bt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},An(l)?_d(t,e):(e=xi(l,t,e,a),e!==null&&(dt(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=bt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(An(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,mt(c,i))return un(l,t,u,0),Sl===null&&an(),!1}catch{}if(e=xi(l,t,u,a),e!==null)return dt(e,l,a),Ad(e,t,a),!0}return!1}function Sc(l,t,e,a){if(a={lane:2,revertLane:$c(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},An(l)){if(t)throw Error(v(479))}else t=xi(l,e,a,2),t!==null&&dt(t,l,2)}function An(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Ma=Sn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:kl,use:zn,useCallback:jl,useContext:jl,useEffect:jl,useImperativeHandle:jl,useLayoutEffect:jl,useInsertionEffect:jl,useMemo:jl,useReducer:jl,useRef:jl,useState:jl,useDebugValue:jl,useDeferredValue:jl,useTransition:jl,useSyncExternalStore:jl,useId:jl,useHostTransitionStatus:jl,useFormState:jl,useActionState:jl,useOptimistic:jl,useMemoCache:jl,useCacheRefresh:jl};bu.useEffectEvent=jl;var Od={readContext:kl,use:zn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:kl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,Tn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return Tn(4194308,4,l,t)},useInsertionEffect:function(l,t){Tn(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){se(!0);try{l()}finally{se(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){se(!0);try{e(t)}finally{se(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=oc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:vc,useDeferredValue:function(l,t){var e=tt();return yc(e,l,t)},useTransition:function(){var l=oc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=tt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),Sl===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Da(9,{destroy:void 0},ks.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=Sl.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-rt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=bn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[ut]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Pt(t)}}return pl(t),Cc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&Pt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=Z.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ve(t,!0)}else l=Kn(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return pl(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),l=!1}else e=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(ht(t),t):(ht(t),null);if((t.flags&128)!==0)throw Error(v(558))}return pl(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),u=!1}else u=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ht(t),t):(ht(t),null)}return ht(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Nn(t,t.updateQueue),pl(t),null);case 4:return El(),l===null&&lf(t.stateNode.containerInfo),pl(t),null;case 10:return Wt(t.type),pl(t),null;case 19:if(m(Cl),a=t.memoizedState,a===null)return pl(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Dl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=gn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Nn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Cl,Cl.current&1|2),ul&&wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&D()>xn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=gn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Nn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return pl(t),null}else 2*D()-a.renderingStartTime>xn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=D(),l.sibling=null,e=Cl.current,O(Cl,u?e&1|2:e&1),ul&&wt(t,a.treeForkCount),l):(pl(t),null);case 22:case 23:return ht(t),tc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),e=t.updateQueue,e!==null&&Nn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),Wt(xl),pl(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Xi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return Wt(xl),El(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(ht(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(ht(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Cl),null;case 4:return El(),null;case 10:return Wt(t.type),null;case 22:case 23:return ht(t),tc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return Wt(xl),null;case 25:return null;default:return null}}function $d(l,t){switch(Xi(t),t.tag){case 3:Wt(xl),El();break;case 26:case 27:case 5:Tt(t);break;case 4:El();break;case 31:t.memoizedState!==null&&ht(t);break;case 13:ht(t);break;case 19:m(Cl);break;case 10:Wt(t.type);break;case 22:case 23:ht(t),tc(),l!==null&&m(Je);break;case 24:Wt(xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){ml(t,t.return,c)}}function ze(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(z){ml(u,f,z)}}}a=a.next}while(a!==n)}}catch(z){ml(t,t.return,z)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){ml(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){ml(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){ml(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){ml(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){ml(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){ml(l,l.return,u)}}function Hc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[ut]=t}catch(u){ml(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&je(l.type)||l.tag===4}function Rc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&je(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function xc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Lt));else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(xc(l,t,e),l=l.sibling;l!==null;)xc(l,t,e),l=l.sibling}function Un(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Un(l,t,e),l=l.sibling;l!==null;)Un(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[ut]=e}catch(n){ml(l,l.return,n)}}var le=!1,Yl=!1,qc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function cv(l,t){if(l=l.containerInfo,af=In,l=vs(l),Di(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,z=0,A=l,S=null;t:for(;;){for(var E;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(E=A.firstChild)!==null;)S=A,A=E;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++z===a&&(f=i),(E=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=E}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(uf={focusedElem:l,selectionRange:e},In=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cgl&&(i=gl,gl=X,X=i);var r=rs(c,X),s=rs(c,gl);if(r&&s&&(E.rangeCount!==1||E.anchorNode!==r.node||E.anchorOffset!==r.offset||E.focusNode!==s.node||E.focusOffset!==s.offset)){var y=A.createRange();y.setStart(r.node,r.offset),E.removeAllRanges(),X>gl?(E.addRange(y),E.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),E.addRange(y))}}}}for(A=[],E=c;E=E.parentNode;)E.nodeType===1&&A.push({element:E,left:E.scrollLeft,top:E.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Vc,Vc=null;var n=Ae,i=ne;if(Ql=0,Ra=Ae=null,ne=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{M.p=u,p.T=a,Co(l,t)}}function Ro(l,t,e){t=Mt(e,t),t=pc(l.stateNode,t,2),l=Se(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function ml(l,t,e){if(l.tag===3)Ro(l,l,e);else for(;t!==null;){if(t.tag===3){Ro(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(_e===null||!_e.has(a))){l=Mt(e,l),e=Rd(2),a=Se(t,e,2),a!==null&&(xd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function wc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Gc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,Sl===l&&(el&e)===e&&(Dl===4||Dl===3&&(el&62914560)===el&&300>D()-Rn?(dl&2)===0&&xa(l,0):Xc|=e,Ha===el&&(Ha=0)),Qt(l)}function xo(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),xo(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),xo(l,e)}function Sv(l,t){return ea(l,t)}var Qn=null,Ba=null,kc=!1,Zn=!1,Wc=!1,Me=0;function Qt(l){l!==Ba&&l.next===null&&(Ba===null?Qn=Ba=l:Ba=Ba.next=l),Zn=!0,kc||(kc=!0,Ev())}function Du(l,t){if(!Wc&&Zn){Wc=!0;do for(var e=!1,a=Qn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-rt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Ku(a,a===Sl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||ka(a,n)||(e=!0,Go(a,n));a=a.next}while(e);Wc=!1}}function bv(){qo()}function qo(){Zn=kc=!1;var l=0;Me!==0&&Nv()&&(l=Me);for(var t=D(),e=null,a=Qn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Qn=u:e.next=u,u===null&&(Ba=e)):(e=a,(l!==0||(n&3)!==0)&&(Zn=!0)),a=u}Ql!==0&&Ql!==5||Du(l),Me!==0&&(Me=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var z=f.transferSize,A=f.initiatorType;z&&wo(A)&&(f=f.responseEnd,i+=z*(f"u"?null:document;function nr(l,t,e){var a=Ya;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Gv(l){ie.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ie.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ie.L(l,t,e);var a=Ya;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Ga(l);break;case"script":n=Xa(l)}Ht.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Zv(l,t){ie.m(l,t);var e=Ya;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Xa(l)}if(!Ht.has(n)&&(l=R({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ie.S(l,t,e);var a=Ya;if(a&&l){var u=ca(a).hoistableStyles,n=Ga(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&rf(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(h,z){f.onload=h,f.onerror=z}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,wn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ie.X(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ie.M(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=Z.current)?Jn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Ga(e.href),e=ca(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Ga(e.href);var n=ca(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Xa(e),e=ca(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Ga(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Xa(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),wn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Ga(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=cr(e),(u=Ht.get(u))&&rf(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,wn(n,e.precedence,l),t.instance=n;case"script":return n=Xa(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=R({},e),mf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wn(a,e.precedence,l));return t.instance}function wn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function kv(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Ga(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=cr(a),(u=Ht.get(u))&&rf(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var vf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&Fn(l,l.stylesheets),0vf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var $n=null;function Fn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,$n=new Map,t.forEach($v,l),$n=null,Wn.call(l))}function $v(l,t){if(!(t.state.loading&4)){var e=$n.get(l);if(e)var a=e.get(null);else{e=new Map,$n.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Tf.exports=yy(),Tf.exports}var gy=hy();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const C=o.camera;if(_l.camera==="head")o.controls.target.set(0,10,0),C.position.set(10,12,18);else{o.controls.target.set(0,0,0);const j=48;_l.camera==="front"?C.position.set(0,0,j):_l.camera==="back"?C.position.set(0,0,-j):C.position.set(23,7,42)}C.lookAt(o.controls.target),C.updateProjectionMatrix(),o.controls.update()}function Gr(){_l.syncing=!0;try{_l.viewers.forEach(o=>Sy(o.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===_l.camera))}function by(o){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:C}of _l.viewers)C!==o&&(C.camera.position.copy(o.camera.position),C.camera.quaternion.copy(o.camera.quaternion),C.camera.zoom=o.camera.zoom,C.controls.target.copy(o.controls.target),C.camera.updateProjectionMatrix(),C.controls.update())}finally{_l.syncing=!1}}}function Ey(o,C,j){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let N;try{N=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),N.controls.enablePan=!1,N.controls.enableDamping=!1,N.controls.minDistance=12,N.controls.maxDistance=120,N.controls.addEventListener("change",()=>by(N));const L=new ResizeObserver(()=>{!N.disposed&&o.clientWidth&&o.clientHeight&&(N.width=o.clientWidth,N.height=o.clientHeight)});L.observe(o),_l.viewers.push({viewer:N,observer:L}),Promise.resolve(N.loadSkin(C.url,{model:"default"})).then(()=>{j!==_l.generation||N.disposed||(N.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{j===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{N&&!N.disposed&&N.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function zy(o,C){Ey(o,C,_l.generation),Gr();const j=_l.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||_l.viewers.at(-1);return()=>{j&&(j.observer.disconnect(),j.viewer.dispose(),j.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==j))}}function py(o,C,j){const v=_l.camera!==o;Object.assign(_l,{camera:o,outerLayer:C,uvOnly:j}),v&&Gr(),_l.viewers.forEach(({viewer:N})=>{N.playerObject.skin.setOuterLayerVisible(C),N.renderPaused=j})}async function ii(o,C,j){const v=await fetch("/api/meat-model/"+o,C===void 0?{signal:j}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C),signal:j}),N=await v.json();if(!v.ok)throw Error(N.error||"预选服务暂不可用");return N}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const C={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别 meat",complete:"已完成",failed:"失败"},j=o?.progress;return(C[o?.stage]||"正在预选")+(j?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型"}[j.variant]||"DINO+局部特征"} ${j.fold}/${j.total} 组`:j?.remaining?` · 剩余 ${j.remaining} 张`:j?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,C]=V.useState(null),[j,v]=V.useState(""),[N,L]=V.useState(!1),k=V.useRef(!0),nl=V.useRef(null),U=V.useRef(!1),T=async()=>{try{const Y=await ii("status");k.current&&(C(Y),v(""))}catch(Y){k.current&&v(Y.message)}};V.useEffect(()=>{k.current=!0,T();const Y=()=>T();return window.addEventListener("meat-saved",Y),nl.current=setInterval(T,1e4),()=>{k.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",Y)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const Y=await ii("train",{});k.current&&C(vl=>({...vl,training:Y}))}catch(Y){k.current&&v(Y.message)}finally{U.current=!1,k.current&&(L(!1),T())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"仅在点击按钮时训练并更新六面+表面结构模型;保存标注不会自动训练。已保存的细分类参与辅助训练,未细标格仍用于二分类。"}),o?.dataset&&g.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:R,disabled:N||Q||!o?.active||o?.dataset?.count<3,children:N?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&g.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是新皮肤准确率,预选仍需人工检查。"]}),!!o?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((Y,vl)=>g.jsxs("p",{children:[Y.id,":",Y.reason]},vl))]}),j&&g.jsx("p",{className:"meat-warning",role:"alert",children:j})]})}function Uy({data:o,disabled:C,onStart:j,onEnd:v,onApply:N}){const[L,k]=V.useState(!1),[nl,U]=V.useState(""),[T,Q]=V.useState(""),R=V.useRef(!0),Y=V.useRef(null),vl=V.useRef(!1);V.useEffect(()=>(R.current=!0,()=>{R.current=!1,Y.current?.abort()}),[]);const Al=async()=>{if(vl.current)return;vl.current=!0,k(!0),Q(""),U("正在请求预选…"),j(),Y.current=new AbortController;const Nl=Y.current.signal;try{let K=await ii("predict",{key:o.key,skin_revision:o.skin_revision},Nl);for(;!Xr(K.stage);){if(!R.current||(U(Qr(K)),await new Promise(bl=>setTimeout(bl,1500)),!R.current))return;K=await ii("job?id="+encodeURIComponent(K.id),void 0,Nl)}if(K.stage==="failed")throw Error(K.error||"预选失败,请稍后重试");if(K.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");R.current&&(N(K.prediction),U(`预选来自 ${K.prediction.model_id} · ${K.prediction.selected.length} 格。请检查并修改,再保存。`))}catch(K){R.current&&K.name!=="AbortError"&&(Q(K.message),U(""))}finally{vl.current=!1,R.current&&(k(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:Al,disabled:C||L||o.model!=="classic",children:L?"模型预选中…":"模型预选"}),g.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),nl&&g.jsx("p",{role:"status",children:nl}),T&&g.jsx("p",{role:"alert",className:"meat-warning",children:T})]})}const _y=V.lazy(()=>Yr(()=>import("./SkinEditor-B3e0be2n.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=V.lazy(()=>Yr(()=>import("./MeatEditor-BnFhxK7E.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ni=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,C)=>C==="all"||C==="perfect"&&!!o.perfect||C==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||C==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||C==="best"&&!!o.best||C==="ordinary"&&!!o.best&&!o.perfect||o.rejection===C,Br=o=>o.version==="original"?"原版":o.version;async function Za(o,C){const j=await fetch(o,C===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C)}),v=await j.json();if(!j.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const C=V.useRef(null);return V.useEffect(()=>zy(C.current,o),[o.url]),g.jsxs("div",{className:"skin-stage",ref:C,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,C]=V.useState([]),[j,v]=V.useState(null),[N,L]=V.useState("pending"),[k,nl]=V.useState("all"),[U,T]=V.useState(""),[Q,R]=V.useState(""),[Y,vl]=V.useState(new Set),[Al,Nl]=V.useState([]),[K,bl]=V.useState(!1),[Gl,Xl]=V.useState(null),[Fl,Et]=V.useState("angle"),[Zl,I]=V.useState(!0),[Ul,zt]=V.useState(!1),[et,Kl]=V.useState(null),[Ml,pt]=V.useState(null),[il,Il]=V.useState(null),[p,M]=V.useState(!1),H=V.useRef(!1),sl=V.useRef(null),ol=V.useRef(null),d=V.useRef(null),m=o.find(b=>b.key===j),O=(b,D=N,tl=U,Pl=Q,Ol=k)=>(!tl||ni(b)===tl)&&b.id.toLowerCase().includes(Pl.trim().toLowerCase())&&(D==="all"||D==="pending"&&b.results.length>0&&!Re(b)||D==="done"&&Re(b)&&My(b,Ol)||D==="rejected"&&!!b.rejection||D==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,Z=(b,D=!1)=>Xl({message:b,error:D}),F=(b,D=!0)=>{H.current||(D&&j&&j!==b&&Nl(tl=>[...tl,j]),v(b))},Rl=(b=N,D=U,tl=Q,Pl=Y)=>o.find(Ol=>O(Ol,b,D,tl)&&!Pl.has(Ol.key))?.key||null,El=(b=o,D=Y)=>{const tl=b.filter(Ol=>O(Ol)&&!D.has(Ol.key)&&Ol.key!==j),Pl=b.findIndex(Ol=>Ol.key===j);F((tl.find(Ol=>b.indexOf(Ol)>Pl)||tl[0])?.key||null)};async function ce(b=!1){if(!H.current){H.current=!0,bl(!0);try{const D=await Za(b?"/api/refresh":"/api/state",b?{}:void 0);C(D.items),v(D.items.find(tl=>tl.key===j&&O(tl))?.key||D.items.find(tl=>O(tl)&&!Y.has(tl.key))?.key||null),b&&Z("目录已刷新")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function Tt(b,D,tl){if(!(H.current||!m)){H.current=!0,bl(!0);try{const Pl=await Za("/api/"+b,{key:m.key,revision:m.revision,result:D?.name,reason:typeof D=="string"?D:void 0,png:tl}),Ol=o.map(Ja=>Ja.key===j?Pl.item:Ja);C(Ol);const at=new Set(Y);at.delete(j),vl(at),H.current=!1,pt(null),b!=="clear"&&El(Ol,at),Z(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}async function la(b=m){if(!(H.current||!b?.perfect)){H.current=!0,bl(!0);try{const D=await Za("/api/meat?key="+encodeURIComponent(b.key)),tl=await Za(`/api/meat-semantic?key=${encodeURIComponent(b.key)}`);M(!1),Il({...D,semantic:tl})}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}const Va=()=>{H.current||p&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(Il(null),M(!1))};async function Zt(b){if(!(H.current||!il)){H.current=!0,bl(!0);try{const D=await Za("/api/meat-semantic",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,semantic_revision:il.semantic.semantic_revision,labels:b});Il({...il,semantic:D}),M(!1),window.dispatchEvent(new Event("meat-saved")),Z("细分类已保存,meat 标注保持不变")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function La(b,D,tl){if(!(H.current||!il)){H.current=!0,bl(!0);try{const Pl=await Za("/api/meat",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,selected:b,assistance:tl});window.dispatchEvent(new Event("meat-saved"));const Ol=o.map(at=>at.key===il.key?Pl.item:at);if(C(Ol),Il(null),M(!1),Z("meat 已保存 · "+il.id+" · "+b.length+" 格"),H.current=!1,D){const at=Ol.findIndex(fe=>fe.key===il.key),aa=[...Ol.slice(at+1),...Ol.slice(0,at)].find(fe=>fe.perfect&&fe.meat_status!=="saved"&&(!U||ni(fe)===U)&&fe.id.toLowerCase().includes(Q.trim().toLowerCase()));aa?(F(aa.key),await la(aa)):Z("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}function ta(){if(H.current||!m)return;const b=new Set(Y);b.add(j),vl(b),El(o,b)}function Qu(){!H.current&&Al.length&&(v(Al.at(-1)),Nl(Al.slice(0,-1)))}V.useEffect(()=>{ce()},[]),V.useEffect(()=>py(Fl,Zl,Ul),[Fl,Zl,Ul,j]),V.useEffect(()=>{if(!Gl)return;const b=setTimeout(()=>Xl(null),Gl.error?8e3:3500);return()=>clearTimeout(b)},[Gl]),V.useEffect(()=>{et&&sl.current?.showModal()},[et]),V.useEffect(()=>{Ml&&ol.current?.showModal()},[Ml]),V.useEffect(()=>{il&&d.current?.showModal()},[il]),V.useEffect(()=>{const b=D=>{if(!(K||et||Ml||il||D.ctrlKey||D.metaKey||D.altKey||D.target.closest("input,select,textarea,[contenteditable]"))){if(D.key.toLowerCase()==="s")D.preventDefault(),ta();else if(D.key==="ArrowLeft")D.preventDefault(),Qu();else if(D.key==="ArrowRight")D.preventDefault(),El();else if(/^[1-9]$/.test(D.key)){const tl=m?.results[+D.key-1];tl&&(D.preventDefault(),Tt("choose",tl))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Bt=o.filter(b=>!U||ni(b)===U),xe=Bt.filter(Re).length,ea=xe+Bt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Bt.filter(Re).length,pending:Bt.filter(b=>b.results.length&&!Re(b)).length,rejected:Bt.filter(b=>b.rejection).length,all:Bt.length,no_results:Bt.filter(b=>!b.results.length).length},ci=b=>{H.current||(L(b),F(Rl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[xe," / ",ea]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${xe/(ea||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:K,onClick:()=>ce(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,D])=>g.jsxs("button",{"data-filter":b,disabled:K,className:N===b?"active":"",onClick:()=>ci(b),children:[D," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:K,value:U,onChange:b=>{T(b.target.value),F(Rl(N,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ni))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:K,value:Q,onChange:b=>{R(b.target.value),F(Rl(N,U,b.target.value))}})]}),N==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:K,value:k,onChange:b=>{const D=b.target.value;nl(D),F(o.find(tl=>O(tl,"done",U,Q,D)&&!Y.has(tl.key))?.key||null)},children:Object.entries(Oy).map(([b,D])=>g.jsxs("option",{value:b,children:[D," ·"," ",o.filter(tl=>O(tl,"done",U,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(Ty,{}),g.jsx("main",{children:m?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:m.folder}),g.jsx("h2",{id:"itemId",children:m.id}),g.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:K,value:j,onChange:b=>{const D=new Set(Y);D.delete(b.target.value),vl(D),F(b.target.value)},children:J.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,D,tl])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",D]}),g.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!tl,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:tl,title:m.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:tl||void 0,alt:D})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!tl,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:K||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:K||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Kl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:K,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),g.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:K,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,D])=>g.jsx("button",{"data-camera":b,className:Fl===b?"active":"",onClick:()=>Et(b),children:D},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:b=>I(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Ul,onClick:()=>zt(!Ul),children:Ul?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Ul?" uv-only":""),children:[m.results.map((b,D)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:Br(b)}),g.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":D+1})]}),g.jsx(jy,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Kl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:K||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:K||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:K,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:K,onClick:()=>{vl(new Set),L("pending"),T(""),R(""),F(Rl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:K||!Al.length,onClick:Qu,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:K||!m,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",Y.size," 项 · 忽略不保存"]})]}),Gl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(Gl.error?" error":""),children:Gl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>Kl(null),onClick:b=>{b.target===b.currentTarget&&Kl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),K||pt(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:()=>pt(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?g.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_y,{textureUrl:Ml.url,busy:K,onError:b=>Z(b,!0),onSubmit:b=>Tt("repair",Ml.result,b)})})})]}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]}),il&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),Va()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["meat 标注 · ",il.id," · ",il.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:Va,children:"关闭 ×"})]}),g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载 meat 标注器…"}),children:g.jsx(Ay,{data:il,busy:K,onSave:La,onSaveSemantic:Zt,onDirty:M},il.key)}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]})]})}gy.createRoot(document.getElementById("root")).render(g.jsx(Dy,{}));export{Uy as M,Ny as R,Mf as a,ry as b,cy as g,g as j,V as r}; diff --git a/best_annotator/static/assets/index-CzS-rxOV.js b/best_annotator/static/assets/index-CzS-rxOV.js new file mode 100644 index 0000000000000000000000000000000000000000..4130ec8660f62ee5b0b0ff3f061dc38454b45c3b --- /dev/null +++ b/best_annotator/static/assets/index-CzS-rxOV.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-DME5JXP2.js","assets/OrbitControls-BNs7WpFn.js","assets/SkinEditor-BzPsKcct.css","assets/MeatEditor-CAGZvGnO.js"])))=>i.map(i=>d[i]); +(function(){const N=document.createElement("link").relList;if(N&&N.supports&&N.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const L of D)if(L.type==="childList")for(const $ of L.addedNodes)$.tagName==="LINK"&&$.rel==="modulepreload"&&v($)}).observe(document,{childList:!0,subtree:!0});function M(D){const L={};return D.integrity&&(L.integrity=D.integrity),D.referrerPolicy&&(L.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?L.credentials="include":D.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(D){if(D.ep)return;D.ep=!0;const L=M(D);fetch(D.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(N,M,v){let D=Promise.resolve();if(M&&M.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const $=document.querySelector("meta[property=csp-nonce]"),nl=$?.nonce||$?.getAttribute("nonce");D=U(M.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const B=document.createElement("link");if(B.rel=Q?"stylesheet":ny,Q||(B.as="script"),B.crossOrigin="",B.href=T,nl&&B.setAttribute("nonce",nl),document.head.appendChild(B),Q)return new Promise((rl,ml)=>{B.addEventListener("load",rl),B.addEventListener("error",()=>ml(new Error(`Unable to preload CSS for ${T}`)))})}))}function L($){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=$,window.dispatchEvent(nl),!nl.defaultPrevented)throw $}return D.then($=>{for(const nl of $||[])nl.status==="rejected"&&L(nl.reason);return N().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var zf={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.fragment");function M(v,D,L){var $=null;if(L!==void 0&&($=""+L),D.key!==void 0&&($=""+D.key),"key"in D){L={};for(var nl in D)nl!=="key"&&(L[nl]=D[nl])}else L=D;return D=L.ref,{$$typeof:o,type:v,key:$,ref:D!==void 0?D:null,props:L}}return Gu.Fragment=N,Gu.jsx=M,Gu.jsxs=M,Gu}var Mr;function sy(){return Mr||(Mr=1,zf.exports=fy()),zf.exports}var y=sy(),Ef={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),$=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.iterator;function rl(d){return d===null||typeof d!="object"?null:(d=B&&d[B]||d["@@iterator"],typeof d=="function"?d:null)}var ml={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,tl={};function Al(d,m,O){this.props=d,this.context=m,this.refs=tl,this.updater=O||ml}Al.prototype.isReactComponent={},Al.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},Al.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Ol(){}Ol.prototype=Al.prototype;function il(d,m,O){this.props=d,this.context=m,this.refs=tl,this.updater=O||ml}var bl=il.prototype=new Ol;bl.constructor=il,Nl(bl,Al.prototype),bl.isPureReactComponent=!0;var tt=Array.isArray;function Bl(){}var F={H:null,A:null,T:null,S:null},Dl=Object.prototype.hasOwnProperty;function Et(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function et(d,m){return Et(d.type,m,d.props)}function Jl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ul(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function zl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ul(""+d.key):m.toString(36)}function Pl(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Bl,Bl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var V=typeof d;(V==="undefined"||V==="boolean")&&(d=null);var I=!1;if(d===null)I=!0;else switch(V){case"bigint":case"string":case"number":I=!0;break;case"object":switch(d.$$typeof){case o:case N:I=!0;break;case Q:return I=d._init,p(I(d._payload),m,O,x,J)}}if(I)return J=J(d),I=x===""?"."+zl(d,0):x,tt(J)?(O="",I!=null&&(O=I.replace(pt,"$&/")+"/"),p(J,m,O,"",function(fe){return fe})):J!=null&&(Jl(J)&&(J=et(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+I)),m.push(J)),1;I=0;var Yl=x===""?".":x+":";if(tt(d))for(var pl=0;pl>>1,ol=p[sl];if(0>>1;slD(O,C))xD(J,O)?(p[sl]=J,p[x]=C,sl=x):(p[sl]=O,p[m]=C,sl=m);else if(xD(J,C))p[sl]=J,p[x]=C,sl=x;else break l}}return j}function D(p,j){var C=p.sortIndex-j.sortIndex;return C!==0?C:p.id-j.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var $=Date,nl=$.now();o.unstable_now=function(){return $.now()-nl}}var U=[],T=[],Q=1,R=null,B=3,rl=!1,ml=!1,Nl=!1,tl=!1,Al=typeof setTimeout=="function"?setTimeout:null,Ol=typeof clearTimeout=="function"?clearTimeout:null,il=typeof setImmediate<"u"?setImmediate:null;function bl(p){for(var j=M(T);j!==null;){if(j.callback===null)v(T);else if(j.startTime<=p)v(T),j.sortIndex=j.expirationTime,N(U,j);else break;j=M(T)}}function tt(p){if(Nl=!1,bl(p),!ml)if(M(U)!==null)ml=!0,Bl||(Bl=!0,Ul());else{var j=M(T);j!==null&&Pl(tt,j.startTime-p)}}var Bl=!1,F=-1,Dl=5,Et=-1;function et(){return tl?!0:!(o.unstable_now()-Etp&&et());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,B=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,bl(p),j=!0;break t}R===M(U)&&v(U),bl(p)}else v(U);R=M(U)}if(R!==null)j=!0;else{var d=M(T);d!==null&&Pl(tt,d.startTime-p),j=!1}}break l}finally{R=null,B=C,rl=!1}j=void 0}}finally{j?Ul():Bl=!1}}}var Ul;if(typeof il=="function")Ul=function(){il(Jl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,zl=pt.port2;pt.port1.onmessage=Jl,Ul=function(){zl.postMessage(null)}}else Ul=function(){Al(Jl,0)};function Pl(p,j){F=Al(function(){p(o.unstable_now())},j)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=C,N(T,p),M(U)===null&&p===M(T)&&(Nl?(Ol(F),F=-1):Nl=!0,Pl(tt,C-sl))):(p.sortIndex=ol,N(U,p),ml||rl||(ml=!0,Bl||(Bl=!0,Ul()))),p},o.unstable_shouldYield=et,o.unstable_wrapCallback=function(p){var j=B;return function(){var C=B;B=j;try{return p.apply(this,arguments)}finally{B=C}}}})(_f)),_f}var Ur;function ry(){return Ur||(Ur=1,Tf.exports=oy()),Tf.exports}var Af={exports:{}},Il={};var Cr;function my(){if(Cr)return Il;Cr=1;var o=Of();function N(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),Af.exports=my(),Af.exports}var Hr;function yy(){if(Hr)return Xu;Hr=1;var o=ry(),N=Of(),M=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),V=d(null),I=d(null);function Yl(l,t){switch(O(V,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?$o(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=$o(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function pl(){m(x),m(J),m(V)}function fe(l){l.memoizedState!==null&&O(I,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),I.current===l&&(m(I),Ru._currentValue=C)}var la,La;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",La=-1)":-1u||f[a]!==g[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Vt(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Zt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Vt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,Ka=o.unstable_scheduleCallback,Ja=o.unstable_cancelCallback,b=o.unstable_shouldYield,q=o.unstable_requestPaint,K=o.unstable_now,dt=o.unstable_getCurrentPriorityLevel,Cl=o.unstable_ImmediatePriority,Ht=o.unstable_UserBlockingPriority,ot=o.unstable_NormalPriority,Mf=o.unstable_LowPriority,na=o.unstable_IdlePriority,se=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,rt=null;function de(l){if(typeof se=="function"&&Zr(l),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(wa,l)}catch{}}var mt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Qu=256,Zu=262144,Vu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Lu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function $a(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Vu;return Vu<<=1,(Vu&62914560)===0&&(Vu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,g=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&wu(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function oa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,zi=null,Wu=null;function $f(){if(Wu)return Wu;var l,t=zi,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ya=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ya)return l==="compositionend"||!Ai&&es(l,t)?(l=$f(),Wu=zi=re=null,ya=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=wu(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=wu(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ha=null,Di=null,iu=null,Ni=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ha==null||ha!==wu(a)||(a=ha,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Vn(Di,"onSelect"),0>=i,u-=i,Yt=1<<32-mt(t)+u|e<k?(al=Y,Y=null):al=Y.sibling;var fl=S(r,Y,h[k],_);if(fl===null){Y===null&&(Y=al);break}l&&Y&&fl.alternate===null&&t(r,Y),s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl,Y=al}if(k===h.length)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;kk?(al=Y,Y=null):al=Y.sibling;var He=S(r,Y,fl.value,_);if(He===null){Y===null&&(Y=al);break}l&&Y&&He.alternate===null&&t(r,Y),s=n(He,s,k),cl===null?G=He:cl.sibling=He,cl=He,Y=al}if(fl.done)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;!fl.done;k++,fl=h.next())fl=A(r,fl.value,_),fl!==null&&(s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl);return ul&&$t(r,k),G}for(Y=a(Y);!fl.done;k++,fl=h.next())fl=z(Y,r,k,fl.value,_),fl!==null&&(l&&fl.alternate!==null&&Y.delete(fl.key===null?k:fl.key),s=n(fl,s,k),cl===null?G=fl:cl.sibling=fl,cl=fl);return l&&Y.forEach(function(uy){return t(r,uy)}),ul&&$t(r,k),G}function Sl(r,s,h,_){if(typeof h=="object"&&h!==null&&h.type===Nl&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case rl:l:{for(var G=h.key;s!==null;){if(s.key===G){if(G=h.type,G===Nl){if(s.tag===7){e(r,s.sibling),_=u(s,h.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Dl&&we(G)===s.type){e(r,s.sibling),_=u(s,h.props),ru(_,h),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}h.type===Nl?(_=Ze(h.props.children,r.mode,_,h.key),_.return=r,r=_):(_=nn(h.type,h.key,h.props,null,r.mode,_),ru(_,h),_.return=r,r=_)}return i(r);case ml:l:{for(G=h.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===h.containerInfo&&s.stateNode.implementation===h.implementation){e(r,s.sibling),_=u(s,h.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Bi(h,r.mode,_),_.return=r,r=_}return i(r);case Dl:return h=we(h),Sl(r,s,h,_)}if(Pl(h))return H(r,s,h,_);if(Ul(h)){if(G=Ul(h),typeof G!="function")throw Error(v(150));return h=G.call(h),X(r,s,h,_)}if(typeof h.then=="function")return Sl(r,s,mn(h),_);if(h.$$typeof===il)return Sl(r,s,sn(r,h),_);vn(r,h)}return typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint"?(h=""+h,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,h),_.return=r,r=_):(e(r,s),_=qi(h,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,h,_){try{ou=0;var G=Sl(r,s,h,_);return Ma=null,G}catch(Y){if(Y===Oa||Y===on)throw Y;var cl=yt(29,Y,null,r.mode);return cl.lanes=_,cl.return=r,cl}}}var We=Ys(!0),Gs=Ys(!1),ge=!1;function Wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=un(l),ps(l,null,e),t}return an(l,a,t,e),un(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=Aa;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,g=f.next;f.next=null,i===null?n=g:i.next=g,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=g:c.next=g,E.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,E=g=f=null,c=n;do{var S=c.lane&-536870913,z=S!==c.lane;if(z?(el&S)===S:(a&S)===S){S!==0&&S===_a&&(Ii=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var H=l,X=c;S=t;var Sl=e;switch(X.tag){case 1:if(H=X.payload,typeof H=="function"){A=H.call(Sl,A,S);break l}A=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=X.payload,S=typeof H=="function"?H.call(Sl,A,S):H,S==null)break l;A=R({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,z&&(l.flags|=8192),z=u.callbacks,z===null?u.callbacks=[S]:z.push(S))}else z={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(g=E=z,f=A):E=E.next=z,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;z=c,c=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(!0);E===null&&(f=A),u.baseState=f,u.firstBaseUpdate=g,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,gc(l,!1,t,e);try{var f=u(),g=p.S;if(g!==null&&g(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=wm(f,a);Su(l,t,E,zt(l))}else Su(l,t,a,zt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},zt())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,C,e===null?Pm:function(){return zd(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function zd(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},zt())}function hc(){return Wl(Ru)}function Ed(){return ql().memoizedState}function pd(){return ql().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=zt();l=Se(e);var a=be(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=zt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?_d(t,e):(e=Hi(l,t,e,a),e!==null&&(st(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=zt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,vt(c,i))return an(l,t,u,0),El===null&&en(),!1}catch{}if(e=Hi(l,t,u,a),e!==null)return st(e,l,a),Ad(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:Wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Hi(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Da=gn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:Wl,use:zn,useCallback:xl,useContext:xl,useEffect:xl,useImperativeHandle:xl,useLayoutEffect:xl,useInsertionEffect:xl,useMemo:xl,useReducer:xl,useRef:xl,useState:xl,useDebugValue:xl,useDeferredValue:xl,useTransition:xl,useSyncExternalStore:xl,useId:xl,useHostTransitionStatus:xl,useFormState:xl,useActionState:xl,useOptimistic:xl,useMemoCache:xl,useCacheRefresh:xl};bu.useEffectEvent=xl;var Od={readContext:Wl,use:zn,useCallback:function(l,t){return lt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,pn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return pn(4194308,4,l,t)},useInsertionEffect:function(l,t){pn(4,2,l,t)},useMemo:function(l,t){var e=lt();t=t===void 0?null:t;var a=l();if(ke){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=lt();if(e!==void 0){var u=e(t);if(ke){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=lt();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=lt();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),lt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=lt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),El===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Ua(9,{destroy:void 0},$s.bind(null,a,n,e,t),null),e},useId:function(){var l=lt(),t=El.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-mt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Sn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[wl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch(Fl(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return _l(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=V.current,pa(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=$l,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[wl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ye(t,!0)}else l=Ln(l).createTextNode(a),l[wl]=t,t.stateNode=l}return _l(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=pa(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[wl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(gt(t),t):(gt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return _l(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=pa(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[wl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(gt(t),t):(gt(t),null)}return gt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),_l(t),null);case 4:return pl(),l===null&&Pc(t.stateNode.containerInfo),_l(t),null;case 10:return kt(t.type),_l(t),null;case 19:if(m(Rl),a=t.memoizedState,a===null)return _l(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)Eu(a,!1);else{if(Hl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=hn(l),n!==null){for(t.flags|=128,Eu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Rl,Rl.current&1|2),ul&&$t(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&K()>Hn&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304)}else{if(!u)if(l=hn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),Eu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return _l(t),null}else 2*K()-a.renderingStartTime>Hn&&e!==536870912&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=K(),l.sibling=null,e=Rl.current,O(Rl,u?e&1|2:e&1),ul&&$t(t,a.treeForkCount),l):(_l(t),null);case 22:case 23:return gt(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(_l(t),t.subtreeFlags&6&&(t.flags|=8192)):_l(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Gl),_l(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Gl),pl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(gt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(gt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Rl),null;case 4:return pl(),null;case 10:return kt(t.type),null;case 22:case 23:return gt(t),lc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Gl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:kt(Gl),pl();break;case 26:case 27:case 5:Tt(t);break;case 4:pl();break;case 31:t.memoizedState!==null&>(t);break;case 13:gt(t);break;case 19:m(Rl);break;case 10:kt(t.type);break;case 22:case 23:gt(t),lc(),l!==null&&m(Je);break;case 24:kt(Gl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){yl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,g=c;try{g()}catch(E){yl(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){yl(t,t.return,E)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){yl(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){yl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){yl(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){yl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){yl(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){yl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[at]=t}catch(u){yl(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function xc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Hc(l,t,e),l=l.sibling;l!==null;)Hc(l,t,e),l=l.sibling}function Nn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Nn(l,t,e),l=l.sibling;l!==null;)Nn(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Fl(t,a,e),t[wl]=l,t[at]=e}catch(n){yl(l,l.return,n)}}var te=!1,Zl=!1,Rc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Kl=null;function cv(l,t){if(l=l.containerInfo,ef=Fn,l=vs(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,g=0,E=0,A=l,S=null;t:for(;;){for(var z;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(z=A.firstChild)!==null;)S=A,A=z;for(;;){if(A===l)break t;if(S===e&&++g===u&&(c=i),S===n&&++E===a&&(f=i),(z=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=z}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},Fn=!1,Kl=t;Kl!==null;)if(t=Kl,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Kl=l;else for(;Kl!==null;){switch(t=Kl,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),Fl(n,a,e),n[wl]=l,Ll(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cSl&&(i=Sl,Sl=X,X=i);var r=rs(c,X),s=rs(c,Sl);if(r&&s&&(z.rangeCount!==1||z.anchorNode!==r.node||z.anchorOffset!==r.offset||z.focusNode!==s.node||z.focusOffset!==s.offset)){var h=A.createRange();h.setStart(r.node,r.offset),z.removeAllRanges(),X>Sl?(z.addRange(h),z.extend(s.node,s.offset)):(h.setEnd(s.node,s.offset),z.addRange(h))}}}}for(A=[],z=c;z=z.parentNode;)z.nodeType===1&&A.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Vl=0,qa=Oe=null,ie=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,p.T=a,Co(l,t)}}function Ho(l,t,e){t=Mt(e,t),t=Ec(l.stateNode,t,2),l=be(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function yl(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Hd(2),a=be(t,e,2),a!==null&&(Rd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,El===l&&(el&e)===e&&(Hl===4||Hl===3&&(el&62914560)===el&&300>K()-xn?(dl&2)===0&&Ba(l,0):Gc|=e,Ra===el&&(Ra=0)),Qt(l)}function Ro(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Ro(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Ro(l,e)}function Sv(l,t){return Ka(l,t)}var Xn=null,Ga=null,wc=!1,Qn=!1,$c=!1,je=0;function Qt(l){l!==Ga&&l.next===null&&(Ga===null?Xn=Ga=l:Ga=Ga.next=l),Qn=!0,wc||(wc=!0,zv())}function Du(l,t){if(!$c&&Qn){$c=!0;do for(var e=!1,a=Xn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-mt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Lu(a,a===El?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||$a(a,n)||(e=!0,Go(a,n));a=a.next}while(e);$c=!1}}function bv(){qo()}function qo(){Qn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=K(),e=null,a=Xn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Xn=u:e.next=u,u===null&&(Ga=e)):(e=a,(l!==0||(n&3)!==0)&&(Qn=!0)),a=u}Vl!==0&&Vl!==5||Du(l),je!==0&&(je=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,A=f.initiatorType;E&&wo(A)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function nr(l,t,e){var a=Xa;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Fl(t,"link",l),Ll(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Xa;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Qa(l);break;case"script":n=Za(l)}xt.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),xt.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(xu(n))||t==="script"&&a.querySelector(Hu(n))||(t=a.createElement("link"),Fl(t,"link",l),Ll(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Xa;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Za(l)}if(!xt.has(n)&&(l=R({rel:"modulepreload",href:l},t),xt.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Hu(n)))return}a=e.createElement("link"),Fl(a,"link",l),Ll(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Xa;if(a&&l){var u=sa(a).hoistableStyles,n=Qa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(xu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=xt.get(n))&&of(l,e);var f=i=a.createElement("link");Ll(f),Fl(f,"link",l),f._p=new Promise(function(g,E){f.onload=g,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Jn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Ll(n),Fl(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Ll(n),Fl(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=V.current)?Kn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Qa(e.href),e=sa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Qa(e.href);var n=sa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(xu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),xt.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},xt.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Za(e),e=sa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Qa(l){return'href="'+At(l)+'"'}function xu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Fl(t,"link",e),Ll(t),l.head.appendChild(t))}function Za(l){return'[src="'+At(l)+'"]'}function Hu(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Ll(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Ll(a),Fl(a,"style",u),Jn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Qa(e.href);var n=l.querySelector(xu(u));if(n)return t.state.loading|=4,t.instance=n,Ll(n),n;a=cr(e),(u=xt.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Ll(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Fl(n,"link",a),t.state.loading|=4,Jn(n,e.precedence,l),t.instance=n;case"script":return n=Za(e.src),(u=l.querySelector(Hu(n)))?(t.instance=u,Ll(u),u):(a=e,(u=xt.get(n))&&(a=R({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Ll(u),Fl(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Jn(a,e.precedence,l));return t.instance}function Jn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function $v(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Qa(a.href),n=t.querySelector(xu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=$n.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Ll(n);return}n=t.ownerDocument||t,a=cr(a),(u=xt.get(u))&&of(a,u),n=n.createElement("link"),Ll(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Fl(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=$n.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&kn(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function $n(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Wn=null;function kn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Wn=new Map,t.forEach(kv,l),Wn=null,$n.call(l))}function kv(l,t){if(!(t.state.loading&4)){var e=Wn.get(l);if(e)var a=e.get(null);else{e=new Map,Wn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),pf.exports=yy(),pf.exports}var gy=hy();const jl={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const N=o.camera;if(jl.camera==="head")o.controls.target.set(0,10,0),N.position.set(10,12,18);else{o.controls.target.set(0,0,0);const M=48;jl.camera==="front"?N.position.set(0,0,M):jl.camera==="back"?N.position.set(0,0,-M):N.position.set(23,7,42)}N.lookAt(o.controls.target),N.updateProjectionMatrix(),o.controls.update()}function Gr(){jl.syncing=!0;try{jl.viewers.forEach(o=>Sy(o.viewer))}finally{jl.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===jl.camera))}function by(o){if(!jl.syncing){jl.syncing=!0;try{for(const{viewer:N}of jl.viewers)N!==o&&(N.camera.position.copy(o.camera.position),N.camera.quaternion.copy(o.camera.quaternion),N.camera.zoom=o.camera.zoom,N.controls.target.copy(o.controls.target),N.camera.updateProjectionMatrix(),N.controls.update())}finally{jl.syncing=!1}}}function zy(o,N,M){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:jl.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>by(D));const L=new ResizeObserver(()=>{!D.disposed&&o.clientWidth&&o.clientHeight&&(D.width=o.clientWidth,D.height=o.clientHeight)});L.observe(o),jl.viewers.push({viewer:D,observer:L}),Promise.resolve(D.loadSkin(N.url,{model:"default"})).then(()=>{M!==jl.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(jl.outerLayer),v.hidden=!0)}).catch(()=>{M===jl.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function Ey(o,N){zy(o,N,jl.generation),Gr();const M=jl.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||jl.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),jl.viewers=jl.viewers.filter(v=>v!==M))}}function py(o,N,M){const v=jl.camera!==o;Object.assign(jl,{camera:o,outerLayer:N,uvOnly:M}),v&&Gr(),jl.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(N),D.renderPaused=M})}async function ii(o,N,M){const v=await fetch("/api/meat-model/"+o,N===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const N={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别五类标注",complete:"已完成",failed:"失败"},M=o?.progress;return(N[o?.stage]||"正在预选")+(M?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型",surface_control:"旧结构对照",face_v8:"面部解码器"}[M.variant]||"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,N]=Z.useState(null),[M,v]=Z.useState(""),[D,L]=Z.useState(!1),$=Z.useRef(!0),nl=Z.useRef(null),U=Z.useRef(!1),T=async()=>{try{const B=await ii("status");$.current&&(N(B),v(""))}catch(B){$.current&&v(B.message)}};Z.useEffect(()=>{$.current=!0,T();const B=()=>T();return window.addEventListener("meat-saved",B),nl.current=setInterval(T,1e4),()=>{$.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",B)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const B=await ii("train",{});$.current&&N(rl=>({...rl,training:B}))}catch(B){$.current&&v(B.message)}finally{U.current=!1,$.current&&(L(!1),T())}}};return y.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Meat 预选模型"}),y.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),y.jsx("p",{children:"预选包含裸露皮肤、眼睛、嘴巴、眉毛和胡子。仅在点击训练按钮时更新模型;保存标注不会自动训练。已保存的细分类参与训练,未细标格仍用于二分类。"}),o?.dataset&&y.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),y.jsxs("div",{className:"meat-model-actions",children:[y.jsx("button",{className:"button",onClick:R,disabled:D||Q||!o?.active||o?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),y.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&y.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?o.training.promoted===!1?" · 候选已完成,尚未替换当前模型":" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&y.jsxs("small",{children:["历史皮肤分组验证 · meat 二分类 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是五类准确率或新皮肤准确率,预选仍需人工检查。"]}),o?.active?.fine_metrics&&y.jsxs("p",{children:["已知细标的留出召回:",Object.entries({1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"}).map(([B,rl])=>`${rl} ${((o.active.fine_metrics[B]?.recall||0)*100).toFixed(1)}%`).join(" · "),"。细标含人工与助手来源。"]}),!!o?.dataset?.excluded?.length&&y.jsxs("details",{children:[y.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((B,rl)=>y.jsxs("p",{children:[B.id,":",B.reason]},rl))]}),M&&y.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function Uy({data:o,disabled:N,onStart:M,onEnd:v,onApply:D,hint:L}){const[$,nl]=Z.useState("precision"),[U,T]=Z.useState(!1),[Q,R]=Z.useState(""),[B,rl]=Z.useState(""),ml=Z.useRef(!0),Nl=Z.useRef(null),tl=Z.useRef(!1);Z.useEffect(()=>(ml.current=!0,()=>{ml.current=!1,Nl.current?.abort()}),[]);const Al=async()=>{if(tl.current)return;tl.current=!0,T(!0),rl(""),R("正在请求预选…"),M(),Nl.current=new AbortController;const Ol=Nl.current.signal;try{let il=await ii("predict",{key:o.key,skin_revision:o.skin_revision,preselection_policy:$},Ol);for(;!Xr(il.stage);){if(!ml.current||(R(Qr(il)),await new Promise(bl=>setTimeout(bl,1500)),!ml.current))return;il=await ii("job?id="+encodeURIComponent(il.id),void 0,Ol)}if(il.stage==="failed")throw Error(il.error||"预选失败,请稍后重试");if(il.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");if(ml.current){D(il.prediction);const bl=il.prediction,tt={1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"},Bl=bl.semantic_available?Object.entries(tt).map(([F,Dl])=>`${Dl} ${bl.category_counts?.[F]||0} 格`).join(" · "):`${bl.selected.length} 格 meat(当前旧模型仅支持二分类,已有细分类保留)`;R(`预选来自 ${bl.model_id}${bl.preselection_policy?` · ${bl.preselection_policy==="precision"?"优先减少误选":"均衡召回"}`:""} · ${Bl}${bl.uncertain_count?` · ${bl.uncertain_count} 格不确定,已保持未选,请复核`:""}。切换类别查看高亮;请检查并修改,再保存。`)}}catch(il){ml.current&&il.name!=="AbortError"&&(rl(il.message),R(""))}finally{tl.current=!1,ml.current&&(T(!1),v())}};return y.jsxs("div",{className:"meat-preselect",children:[y.jsx("button",{className:"button secondary",onClick:Al,disabled:N||U||o.model!=="classic",children:U?"五类预选中…":"模型预选五类"}),y.jsxs("label",{children:["预选方式 ",y.jsxs("select",{"aria-label":"预选方式",value:$,disabled:N||U,onChange:Ol=>nl(Ol.target.value),children:[y.jsx("option",{value:"precision",children:"优先减少误选"}),y.jsx("option",{value:"balanced",children:"均衡召回"})]})]}),y.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":L||"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),Q&&y.jsx("p",{role:"status",children:Q}),B&&y.jsx("p",{role:"alert",className:"meat-warning",children:B})]})}const _y=Z.lazy(()=>Yr(()=>import("./SkinEditor-DME5JXP2.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=Z.lazy(()=>Yr(()=>import("./MeatEditor-CAGZvGnO.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ui=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,N)=>N==="all"||N==="perfect"&&!!o.perfect||N==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||N==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||N==="best"&&!!o.best||N==="ordinary"&&!!o.best&&!o.perfect||o.rejection===N,Br=o=>o.version==="original"?"原版":o.version;async function ni(o,N){const M=await fetch(o,N===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const N=Z.useRef(null);return Z.useEffect(()=>Ey(N.current,o),[o.url]),y.jsxs("div",{className:"skin-stage",ref:N,children:[y.jsx("canvas",{}),y.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,N]=Z.useState([]),[M,v]=Z.useState(null),[D,L]=Z.useState("pending"),[$,nl]=Z.useState("all"),[U,T]=Z.useState(""),[Q,R]=Z.useState(""),[B,rl]=Z.useState(new Set),[ml,Nl]=Z.useState([]),[tl,Al]=Z.useState(!1),[Ol,il]=Z.useState(null),[bl,tt]=Z.useState("angle"),[Bl,F]=Z.useState(!0),[Dl,Et]=Z.useState(!1),[et,Jl]=Z.useState(null),[Ul,pt]=Z.useState(null),[zl,Pl]=Z.useState(null),[p,j]=Z.useState(!1),C=Z.useRef(!1),sl=Z.useRef(null),ol=Z.useRef(null),d=Z.useRef(null),m=o.find(b=>b.key===M),O=(b,q=D,K=U,dt=Q,Cl=$)=>(!K||ui(b)===K)&&b.id.toLowerCase().includes(dt.trim().toLowerCase())&&(q==="all"||q==="pending"&&b.results.length>0&&!Re(b)||q==="done"&&Re(b)&&My(b,Cl)||q==="rejected"&&!!b.rejection||q==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,V=(b,q=!1)=>il({message:b,error:q}),I=(b,q=!0)=>{C.current||(q&&M&&M!==b&&Nl(K=>[...K,M]),v(b))},Yl=(b=D,q=U,K=Q,dt=B)=>o.find(Cl=>O(Cl,b,q,K)&&!dt.has(Cl.key))?.key||null,pl=(b=o,q=B)=>{const K=b.filter(Cl=>O(Cl)&&!q.has(Cl.key)&&Cl.key!==M),dt=b.findIndex(Cl=>Cl.key===M);I((K.find(Cl=>b.indexOf(Cl)>dt)||K[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,Al(!0);try{const q=await ni(b?"/api/refresh":"/api/state",b?{}:void 0);N(q.items),v(q.items.find(K=>K.key===M&&O(K))?.key||q.items.find(K=>O(K)&&!B.has(K.key))?.key||null),b&&V("目录已刷新")}catch(q){V(q.message,!0)}finally{C.current=!1,Al(!1)}}}async function Tt(b,q,K){if(!(C.current||!m)){C.current=!0,Al(!0);try{const dt=await ni("/api/"+b,{key:m.key,revision:m.revision,result:q?.name,reason:typeof q=="string"?q:void 0,png:K}),Cl=o.map(ot=>ot.key===M?dt.item:ot);N(Cl);const Ht=new Set(B);Ht.delete(M),rl(Ht),C.current=!1,pt(null),b!=="clear"&&pl(Cl,Ht),V(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(dt){V(dt.message,!0)}finally{C.current=!1,Al(!1)}}}async function la(b=m){if(!(C.current||!b?.perfect)){C.current=!0,Al(!0);try{const q=await ni("/api/meat-labels?key="+encodeURIComponent(b.key));j(!1),Pl(q)}catch(q){V(q.message,!0)}finally{C.current=!1,Al(!1)}}}const La=()=>{C.current||p&&!window.confirm("分类标注尚未保存,放弃本次修改?")||(Pl(null),j(!1))};async function Zt(b,q,K,dt=!1){if(!(C.current||!zl)){C.current=!0,Al(!0);try{const Cl=await ni("/api/meat-labels",{key:zl.key,revision:zl.revision,skin_revision:zl.skin_revision,meat_revision:zl.meat_revision,semantic_revision:zl.semantic.semantic_revision,labels:b,assistance:K,fine_review_complete:dt});window.dispatchEvent(new Event("meat-saved"));const Ht=o.map(ot=>ot.key===zl.key?Cl.item:ot);if(N(Ht),Pl(null),j(!1),V("分类已保存 · "+zl.id+" · "+b.filter(Boolean).length+" 格"),C.current=!1,q){const ot=Ht.findIndex(se=>se.key===zl.key),na=[...Ht.slice(ot+1),...Ht.slice(0,ot)].find(se=>se.perfect&&se.meat_status!=="saved"&&(!U||ui(se)===U)&&se.id.toLowerCase().includes(Q.trim().toLowerCase()));na?(I(na.key),await la(na)):V("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Cl){V(Cl.message,!0)}finally{C.current=!1,Al(!1)}}}function ta(){if(C.current||!m)return;const b=new Set(B);b.add(M),rl(b),pl(o,b)}function ea(){!C.current&&ml.length&&(v(ml.at(-1)),Nl(ml.slice(0,-1)))}Z.useEffect(()=>{fe()},[]),Z.useEffect(()=>py(bl,Bl,Dl),[bl,Bl,Dl,M]),Z.useEffect(()=>{if(!Ol)return;const b=setTimeout(()=>il(null),Ol.error?8e3:3500);return()=>clearTimeout(b)},[Ol]),Z.useEffect(()=>{et&&sl.current?.showModal()},[et]),Z.useEffect(()=>{Ul&&ol.current?.showModal()},[Ul]),Z.useEffect(()=>{zl&&d.current?.showModal()},[zl]),Z.useEffect(()=>{const b=q=>{if(!(tl||et||Ul||zl||q.ctrlKey||q.metaKey||q.altKey||q.target.closest("input,select,textarea,[contenteditable]"))){if(q.key.toLowerCase()==="s")q.preventDefault(),ta();else if(q.key==="ArrowLeft")q.preventDefault(),ea();else if(q.key==="ArrowRight")q.preventDefault(),pl();else if(/^[1-9]$/.test(q.key)){const K=m?.results[+q.key-1];K&&(q.preventDefault(),Tt("choose",K))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Vt=o.filter(b=>!U||ui(b)===U),aa=Vt.filter(Re).length,ua=aa+Vt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Vt.filter(Re).length,pending:Vt.filter(b=>b.results.length&&!Re(b)).length,rejected:Vt.filter(b=>b.rejection).length,all:Vt.length,no_results:Vt.filter(b=>!b.results.length).length},Ja=b=>{C.current||(L(b),I(Yl(b)))};return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-icon",children:"D"}),y.jsxs("div",{children:[y.jsx("h1",{children:"DDJ 最佳结果标注"}),y.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),y.jsxs("div",{className:"progress",children:[y.jsxs("div",{children:[y.jsx("span",{children:"标注进度"}),y.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),y.jsx("div",{className:"progress-track",children:y.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),y.jsx("button",{id:"refresh",className:"button secondary",disabled:tl,onClick:()=>fe(!0),children:"刷新目录"})]}),y.jsxs("section",{className:"filters",children:[y.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,q])=>y.jsxs("button",{"data-filter":b,disabled:tl,className:D===b?"active":"",onClick:()=>Ja(b),children:[q," ",y.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),y.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:tl,value:U,onChange:b=>{T(b.target.value),I(Yl(D,b.target.value))},children:[y.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ui))].map(b=>y.jsx("option",{children:b},b))]}),y.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:tl,value:Q,onChange:b=>{R(b.target.value),I(Yl(D,U,b.target.value))}})]}),D==="done"&&y.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[y.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),y.jsx("select",{id:"annotationType",disabled:tl,value:$,onChange:b=>{const q=b.target.value;nl(q),I(o.find(K=>O(K,"done",U,Q,q)&&!B.has(K.key))?.key||null)},children:Object.entries(Oy).map(([b,q])=>y.jsxs("option",{value:b,children:[q," ·"," ",o.filter(K=>O(K,"done",U,Q,b)).length]},b))}),y.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),y.jsx(Ty,{}),y.jsx("main",{children:m?y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"item-heading",children:[y.jsxs("div",{children:[y.jsx("span",{className:"eyebrow",children:m.folder}),y.jsx("h2",{id:"itemId",children:m.id}),y.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),y.jsxs("div",{className:"jump",children:[y.jsx("label",{htmlFor:"jump",children:"跳转条目"}),y.jsx("select",{id:"jump",disabled:tl,value:M,onChange:b=>{const q=new Set(B);q.delete(b.target.value),rl(q),I(b.target.value)},children:J.map(b=>y.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),y.jsxs("div",{className:"workspace",id:"workspace",children:[y.jsxs("aside",{className:"source-panel panel",children:[y.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,q,K])=>y.jsxs("section",{className:"reference-image",children:[y.jsxs("div",{className:"panel-title",children:[y.jsxs("h3",{children:[b," · ",q]}),y.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),y.jsx("button",{hidden:!K,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Jl({url:K,title:m.id+"_"+b}),children:y.jsx("img",{id:b+"Image",src:K||void 0,alt:q})}),b==="edited"&&y.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!K,children:"暂无 edited 图片"})]},b))}),y.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),y.jsxs("div",{className:"reject-actions",children:[y.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:tl||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),y.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:tl||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),y.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[y.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),y.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&y.jsx("button",{className:"text-button",onClick:()=>Jl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&y.jsxs("div",{className:"meat-entry",children:[y.jsx("button",{id:"annotateMeat",className:"button",disabled:tl,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑分类":"标注皮肤分类"}),y.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),y.jsx("button",{id:"clearBest",className:"text-button",disabled:tl,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),y.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),y.jsxs("section",{className:"comparison",children:[y.jsxs("div",{className:"comparison-toolbar",children:[y.jsxs("div",{className:"camera-buttons",children:[y.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,q])=>y.jsx("button",{"data-camera":b,className:bl===b?"active":"",onClick:()=>tt(b),children:q},b))]}),y.jsxs("div",{className:"view-options",children:[y.jsxs("label",{children:[y.jsx("input",{id:"outerLayer",type:"checkbox",checked:Bl,onChange:b=>F(b.target.checked)}),"显示外层"]}),y.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Dl,onClick:()=>Et(!Dl),children:Dl?"显示 3D":"只看 UV"})]})]}),y.jsxs("div",{id:"results",className:"result-grid"+(Dl?" uv-only":""),children:[m.results.map((b,q)=>y.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[y.jsxs("div",{className:"result-header",children:[y.jsx("span",{className:"version-name",children:Br(b)}),y.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":q+1})]}),y.jsx(jy,{result:b}),y.jsxs("div",{className:"uv-area",children:[y.jsx("button",{className:"uv-button",onClick:()=>Jl({url:b.url,title:b.name,pixelated:!0}),children:y.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),y.jsxs("div",{className:"uv-caption",children:[y.jsx("strong",{children:"UV 贴图"}),y.jsx("span",{children:"点击放大"})]})]}),y.jsxs("div",{className:"result-actions",children:[y.jsx("div",{className:"result-file",children:b.name}),y.jsx("button",{className:"choose-button",disabled:tl||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),y.jsx("button",{className:"perfect-button",disabled:tl||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),y.jsx("button",{className:"repair-button",disabled:tl,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&y.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),y.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):y.jsxs("section",{id:"empty",className:"empty panel",children:[y.jsx("h2",{children:"当前筛选下没有更多条目"}),y.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),y.jsx("button",{id:"resume",className:"button primary",disabled:tl,onClick:()=>{rl(new Set),L("pending"),T(""),R(""),I(Yl("pending","","",new Set))},children:"继续查看待标注"})]})}),y.jsxs("footer",{className:"footer",children:[y.jsxs("div",{className:"navigation",children:[y.jsx("button",{id:"previous",className:"button secondary",disabled:tl||!ml.length,onClick:ea,children:"← 上一个"}),y.jsx("button",{id:"skip",className:"button secondary",disabled:tl||!m,onClick:ta,children:"暂时忽略 →"})]}),y.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),y.jsxs("span",{children:["本次已忽略 ",B.size," 项 · 忽略不保存"]})]}),Ol&&y.jsx("div",{id:"toast",role:"status",className:"toast"+(Ol.error?" error":""),children:Ol.message}),et&&y.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>Jl(null),onClick:b=>{b.target===b.currentTarget&&Jl(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsx("span",{children:et.title}),y.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Jl(null),children:"关闭 ×"})]}),y.jsx("div",{className:"dialog-image",children:y.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ul&&y.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),tl||pt(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["修复 ",Ul.result.name," · 左键绘制,右键旋转"]}),y.jsx("button",{className:"button secondary",disabled:tl,onClick:()=>pt(null),children:"取消 ×"})]}),y.jsxs("div",{className:"editor-content",children:[y.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[y.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?y.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):y.jsx("p",{children:"此条目暂无 edited 图片"})]}),y.jsx("div",{className:"editor-canvas-panel",children:y.jsx(Z.Suspense,{fallback:y.jsx("p",{children:"正在加载皮肤编辑器…"}),children:y.jsx(_y,{textureUrl:Ul.url,busy:tl,onError:b=>V(b,!0),onSubmit:b=>Tt("repair",Ul.result,b)})})})]}),Ol?.error&&y.jsx("p",{role:"alert",children:Ol.message})]}),zl&&y.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),La()},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["皮肤分类 · ",zl.id," · ",zl.model==="slim"?"纤细手臂":"标准手臂"]}),y.jsx("button",{className:"button secondary",disabled:tl,onClick:La,children:"关闭 ×"})]}),y.jsx(Z.Suspense,{fallback:y.jsx("p",{children:"正在加载分类标注器…"}),children:y.jsx(Ay,{data:zl,busy:tl,onSave:Zt,onDirty:j},zl.key)}),Ol?.error&&y.jsx("p",{role:"alert",children:Ol.message})]})]})}gy.createRoot(document.getElementById("root")).render(y.jsx(Dy,{}));export{Uy as M,Ny as R,Of as a,ry as b,cy as g,y as j,Z as r}; diff --git a/best_annotator/static/assets/index-D4HloxTJ.js b/best_annotator/static/assets/index-D4HloxTJ.js new file mode 100644 index 0000000000000000000000000000000000000000..62e137887afd3f8cc29c195f628b045c12ef23d9 --- /dev/null +++ b/best_annotator/static/assets/index-D4HloxTJ.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-TQinzOLu.js","assets/OrbitControls-JGGzURQK.js","assets/SkinEditor-Do5ASu40.css","assets/MeatEditor-WUbpTXnd.js"])))=>i.map(i=>d[i]); +(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const N of document.querySelectorAll('link[rel="modulepreload"]'))v(N);new MutationObserver(N=>{for(const L of N)if(L.type==="childList")for(const k of L.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&v(k)}).observe(document,{childList:!0,subtree:!0});function j(N){const L={};return N.integrity&&(L.integrity=N.integrity),N.referrerPolicy&&(L.referrerPolicy=N.referrerPolicy),N.crossOrigin==="use-credentials"?L.credentials="include":N.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(N){if(N.ep)return;N.ep=!0;const L=j(N);fetch(N.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(C,j,v){let N=Promise.resolve();if(j&&j.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),nl=k?.nonce||k?.getAttribute("nonce");N=U(j.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const Y=document.createElement("link");if(Y.rel=Q?"stylesheet":ny,Q||(Y.as="script"),Y.crossOrigin="",Y.href=T,nl&&Y.setAttribute("nonce",nl),document.head.appendChild(Y),Q)return new Promise((vl,Al)=>{Y.addEventListener("load",vl),Y.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function L(k){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=k,window.dispatchEvent(nl),!nl.defaultPrevented)throw k}return N.then(k=>{for(const nl of k||[])nl.status==="rejected"&&L(nl.reason);return C().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var zf={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function j(v,N,L){var k=null;if(L!==void 0&&(k=""+L),N.key!==void 0&&(k=""+N.key),"key"in N){L={};for(var nl in N)nl!=="key"&&(L[nl]=N[nl])}else L=N;return N=L.ref,{$$typeof:o,type:v,key:k,ref:N!==void 0?N:null,props:L}}return Gu.Fragment=C,Gu.jsx=j,Gu.jsxs=j,Gu}var Mr;function sy(){return Mr||(Mr=1,zf.exports=fy()),zf.exports}var g=sy(),pf={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),k=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),Y=Symbol.iterator;function vl(d){return d===null||typeof d!="object"?null:(d=Y&&d[Y]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,K={};function bl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}bl.prototype.isReactComponent={},bl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},bl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Gl(){}Gl.prototype=bl.prototype;function Xl(d,m,O){this.props=d,this.context=m,this.refs=K,this.updater=O||Al}var Fl=Xl.prototype=new Gl;Fl.constructor=Xl,Nl(Fl,bl.prototype),Fl.isPureReactComponent=!0;var Et=Array.isArray;function Zl(){}var I={H:null,A:null,T:null,S:null},Ul=Object.prototype.hasOwnProperty;function zt(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function et(d,m){return zt(d.type,m,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ml(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function il(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):m.toString(36)}function Il(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var Z=typeof d;(Z==="undefined"||Z==="boolean")&&(d=null);var F=!1;if(d===null)F=!0;else switch(Z){case"bigint":case"string":case"number":F=!0;break;case"object":switch(d.$$typeof){case o:case C:F=!0;break;case Q:return F=d._init,p(F(d._payload),m,O,x,J)}}if(F)return J=J(d),F=x===""?"."+il(d,0):x,Et(J)?(O="",F!=null&&(O=F.replace(pt,"$&/")+"/"),p(J,m,O,"",function(ce){return ce})):J!=null&&(Kl(J)&&(J=et(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+F)),m.push(J)),1;F=0;var Rl=x===""?".":x+":";if(Et(d))for(var El=0;El>>1,ol=p[sl];if(0>>1;slN(O,H))xN(J,O)?(p[sl]=J,p[x]=H,sl=x):(p[sl]=O,p[m]=H,sl=m);else if(xN(J,H))p[sl]=J,p[x]=H,sl=x;else break l}}return M}function N(p,M){var H=p.sortIndex-M.sortIndex;return H!==0?H:p.id-M.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var k=Date,nl=k.now();o.unstable_now=function(){return k.now()-nl}}var U=[],T=[],Q=1,R=null,Y=3,vl=!1,Al=!1,Nl=!1,K=!1,bl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,Xl=typeof setImmediate<"u"?setImmediate:null;function Fl(p){for(var M=j(T);M!==null;){if(M.callback===null)v(T);else if(M.startTime<=p)v(T),M.sortIndex=M.expirationTime,C(U,M);else break;M=j(T)}}function Et(p){if(Nl=!1,Fl(p),!Al)if(j(U)!==null)Al=!0,Zl||(Zl=!0,Ml());else{var M=j(T);M!==null&&Il(Et,M.startTime-p)}}var Zl=!1,I=-1,Ul=5,zt=-1;function et(){return K?!0:!(o.unstable_now()-ztp&&et());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,Y=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,Fl(p),M=!0;break t}R===j(U)&&v(U),Fl(p)}else v(U);R=j(U)}if(R!==null)M=!0;else{var d=j(T);d!==null&&Il(Et,d.startTime-p),M=!1}}break l}finally{R=null,Y=H,vl=!1}M=void 0}}finally{M?Ml():Zl=!1}}}var Ml;if(typeof Xl=="function")Ml=function(){Xl(Kl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,il=pt.port2;pt.port1.onmessage=Kl,Ml=function(){il.postMessage(null)}}else Ml=function(){bl(Kl,0)};function Il(p,M){I=bl(function(){p(o.unstable_now())},M)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=H,C(T,p),j(U)===null&&p===j(T)&&(Nl?(Gl(I),I=-1):Nl=!0,Il(Et,H-sl))):(p.sortIndex=ol,C(U,p),Al||vl||(Al=!0,Zl||(Zl=!0,Ml()))),p},o.unstable_shouldYield=et,o.unstable_wrapCallback=function(p){var M=Y;return function(){var H=Y;Y=M;try{return p.apply(this,arguments)}finally{Y=H}}}})(Af)),Af}var Ur;function ry(){return Ur||(Ur=1,_f.exports=oy()),_f.exports}var Of={exports:{}},lt={};var Cr;function my(){if(Cr)return lt;Cr=1;var o=Mf();function C(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Of.exports=my(),Of.exports}var Rr;function yy(){if(Rr)return Xu;Rr=1;var o=ry(),C=Mf(),j=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),Z=d(null),F=d(null);function Rl(l,t){switch(O(Z,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?ko(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=ko(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function El(){m(x),m(J),m(Z)}function ce(l){l.memoizedState!==null&&O(F,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),F.current===l&&(m(F),xu._currentValue=H)}var la,Va;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==h[u]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=u);break}}}finally{La=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Qu(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ta(l.type,!1);case 11:return ta(l.type.render,!1);case 1:return ta(l.type,!0);case 31:return Zt("Activity");default:return""}}function Bt(l){try{var t="",e=null;do t+=Qu(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var xe=Object.prototype.hasOwnProperty,ea=o.unstable_scheduleCallback,Ka=o.unstable_cancelCallback,ci=o.unstable_shouldYield,b=o.unstable_requestPaint,D=o.unstable_now,tl=o.unstable_getCurrentPriorityLevel,Pl=o.unstable_ImmediatePriority,Ol=o.unstable_UserBlockingPriority,at=o.unstable_NormalPriority,Ja=o.unstable_LowPriority,aa=o.unstable_IdlePriority,fe=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,ot=null;function se(l){if(typeof fe=="function"&&Zr(l),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(wa,l)}catch{}}var rt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Zu=256,Vu=262144,Lu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ku(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function ka(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Lu;return Lu<<=1,(Lu&62914560)===0&&(Lu=4194304),l}function fi(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?yi(l,i,_t(t)):e!=null?yi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){mi(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),mi(l)}function yi(l,t,e){t==="number"&&ku(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function sa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(Kt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{Ei=!1}var oe=null,zi=null,$u=null;function kf(){if($u)return $u;var l,t=zi,e=t.length,a,u="value"in oe?oe.value:oe.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ma=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ma)return l==="compositionend"||!Oi&&es(l,t)?(l=kf(),$u=zi=oe=null,ma=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=ku(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=ku(l.document)}return t}function Di(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Kt&&"documentMode"in document&&11>=document.documentMode,va=null,Ni=null,iu=null,Ui=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ui||va==null||va!==ku(a)||(a=va,"selectionStart"in a&&Di(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Ln(Ni,"onSelect"),0>=i,u-=i,Yt=1<<32-rt(t)+u|e<$?(al=B,B=null):al=B.sibling;var fl=S(r,B,y[$],_);if(fl===null){B===null&&(B=al);break}l&&B&&fl.alternate===null&&t(r,B),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl,B=al}if($===y.length)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;$$?(al=B,B=null):al=B.sibling;var He=S(r,B,fl.value,_);if(He===null){B===null&&(B=al);break}l&&B&&He.alternate===null&&t(r,B),s=n(He,s,$),cl===null?G=He:cl.sibling=He,cl=He,B=al}if(fl.done)return e(r,B),ul&&wt(r,$),G;if(B===null){for(;!fl.done;$++,fl=y.next())fl=A(r,fl.value,_),fl!==null&&(s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return ul&&wt(r,$),G}for(B=a(B);!fl.done;$++,fl=y.next())fl=E(B,r,$,fl.value,_),fl!==null&&(l&&fl.alternate!==null&&B.delete(fl.key===null?$:fl.key),s=n(fl,s,$),cl===null?G=fl:cl.sibling=fl,cl=fl);return l&&B.forEach(function(uy){return t(r,uy)}),ul&&wt(r,$),G}function gl(r,s,y,_){if(typeof y=="object"&&y!==null&&y.type===Nl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case vl:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===Nl){if(s.tag===7){e(r,s.sibling),_=u(s,y.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ul&&we(G)===s.type){e(r,s.sibling),_=u(s,y.props),ru(_,y),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}y.type===Nl?(_=Ze(y.props.children,r.mode,_,y.key),_.return=r,r=_):(_=cn(y.type,y.key,y.props,null,r.mode,_),ru(_,y),_.return=r,r=_)}return i(r);case Al:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(r,s.sibling),_=u(s,y.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Yi(y,r.mode,_),_.return=r,r=_}return i(r);case Ul:return y=we(y),gl(r,s,y,_)}if(Il(y))return q(r,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(r,s,y,_)}if(typeof y.then=="function")return gl(r,s,vn(y),_);if(y.$$typeof===Xl)return gl(r,s,dn(r,y),_);yn(r,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,y),_.return=r,r=_):(e(r,s),_=Bi(y,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,y,_){try{ou=0;var G=gl(r,s,y,_);return Aa=null,G}catch(B){if(B===_a||B===rn)throw B;var cl=vt(29,B,null,r.mode);return cl.lanes=_,cl.return=r,cl}}}var We=Ys(!0),Gs=Ys(!1),he=!1;function $i(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fi(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ge(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Se(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=nn(l),ps(l,null,e),t}return un(l,a,t,e),nn(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Ii(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Pi=!1;function vu(){if(Pi){var l=Ta;if(l!==null)throw l}}function yu(l,t,e,a){Pi=!1;var u=l.updateQueue;he=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var z=l.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=h:c.next=h,z.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,z=h=f=null,c=n;do{var S=c.lane&-536870913,E=S!==c.lane;if(E?(el&S)===S:(a&S)===S){S!==0&&S===pa&&(Pi=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var q=l,X=c;S=t;var gl=e;switch(X.tag){case 1:if(q=X.payload,typeof q=="function"){A=q.call(gl,A,S);break l}A=q;break l;case 3:q.flags=q.flags&-65537|128;case 0:if(q=X.payload,S=typeof q=="function"?q.call(gl,A,S):q,S==null)break l;A=R({},A,S);break l;case 2:he=!0}}S=c.callback,S!==null&&(l.flags|=64,E&&(l.flags|=8192),E=u.callbacks,E===null?u.callbacks=[S]:E.push(S))}else E={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(h=z=E,f=A):z=z.next=E,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;E=c,c=E.next,E.next=null,u.lastBaseUpdate=E,u.shared.pending=null}}while(!0);z===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=z,n===null&&(u.shared.lanes=0),Te|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,Sc(l,!1,t,e);try{var f=u(),h=p.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=wm(f,a);Su(l,t,z,bt(l))}else Su(l,t,a,bt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},bt())}finally{M.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function hc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,H,e===null?Pm:function(){return Ed(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:H},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Ed(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},bt())}function gc(){return kl(xu)}function zd(){return Hl().memoizedState}function pd(){return Hl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=bt();l=ge(e);var a=Se(t,l,e);a!==null&&(dt(a,t,e),mu(a,t,e)),t={cache:Ji()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=bt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},An(l)?_d(t,e):(e=xi(l,t,e,a),e!==null&&(dt(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=bt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(An(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,mt(c,i))return un(l,t,u,0),Sl===null&&an(),!1}catch{}if(e=xi(l,t,u,a),e!==null)return dt(e,l,a),Ad(e,t,a),!0}return!1}function Sc(l,t,e,a){if(a={lane:2,revertLane:$c(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},An(l)){if(t)throw Error(v(479))}else t=xi(l,e,a,2),t!==null&&dt(t,l,2)}function An(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Ma=Sn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:kl,use:zn,useCallback:jl,useContext:jl,useEffect:jl,useImperativeHandle:jl,useLayoutEffect:jl,useInsertionEffect:jl,useMemo:jl,useReducer:jl,useRef:jl,useState:jl,useDebugValue:jl,useDeferredValue:jl,useTransition:jl,useSyncExternalStore:jl,useId:jl,useHostTransitionStatus:jl,useFormState:jl,useActionState:jl,useOptimistic:jl,useMemoCache:jl,useCacheRefresh:jl};bu.useEffectEvent=jl;var Od={readContext:kl,use:zn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:kl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,Tn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return Tn(4194308,4,l,t)},useInsertionEffect:function(l,t){Tn(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){se(!0);try{l()}finally{se(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){se(!0);try{e(t)}finally{se(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=oc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:vc,useDeferredValue:function(l,t){var e=tt();return yc(e,l,t)},useTransition:function(){var l=oc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=tt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),Sl===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Da(9,{destroy:void 0},ks.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=Sl.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-rt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=bn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[ut]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Pt(t)}}return pl(t),Cc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&Pt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=Z.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ve(t,!0)}else l=Kn(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return pl(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),l=!1}else e=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(ht(t),t):(ht(t),null);if((t.flags&128)!==0)throw Error(v(558))}return pl(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),u=!1}else u=Zi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ht(t),t):(ht(t),null)}return ht(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Nn(t,t.updateQueue),pl(t),null);case 4:return El(),l===null&&lf(t.stateNode.containerInfo),pl(t),null;case 10:return Wt(t.type),pl(t),null;case 19:if(m(Cl),a=t.memoizedState,a===null)return pl(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Dl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=gn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Nn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Cl,Cl.current&1|2),ul&&wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&D()>xn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=gn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Nn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return pl(t),null}else 2*D()-a.renderingStartTime>xn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=D(),l.sibling=null,e=Cl.current,O(Cl,u?e&1|2:e&1),ul&&wt(t,a.treeForkCount),l):(pl(t),null);case 22:case 23:return ht(t),tc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),e=t.updateQueue,e!==null&&Nn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),Wt(xl),pl(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Xi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return Wt(xl),El(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(ht(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(ht(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Cl),null;case 4:return El(),null;case 10:return Wt(t.type),null;case 22:case 23:return ht(t),tc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return Wt(xl),null;case 25:return null;default:return null}}function $d(l,t){switch(Xi(t),t.tag){case 3:Wt(xl),El();break;case 26:case 27:case 5:Tt(t);break;case 4:El();break;case 31:t.memoizedState!==null&&ht(t);break;case 13:ht(t);break;case 19:m(Cl);break;case 10:Wt(t.type);break;case 22:case 23:ht(t),tc(),l!==null&&m(Je);break;case 24:Wt(xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){ml(t,t.return,c)}}function ze(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(z){ml(u,f,z)}}}a=a.next}while(a!==n)}}catch(z){ml(t,t.return,z)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){ml(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){ml(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){ml(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){ml(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){ml(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){ml(l,l.return,u)}}function Hc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[ut]=t}catch(u){ml(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&je(l.type)||l.tag===4}function Rc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&je(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function xc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Lt));else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(xc(l,t,e),l=l.sibling;l!==null;)xc(l,t,e),l=l.sibling}function Un(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&je(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Un(l,t,e),l=l.sibling;l!==null;)Un(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[ut]=e}catch(n){ml(l,l.return,n)}}var le=!1,Yl=!1,qc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function cv(l,t){if(l=l.containerInfo,af=In,l=vs(l),Di(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,z=0,A=l,S=null;t:for(;;){for(var E;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(E=A.firstChild)!==null;)S=A,A=E;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++z===a&&(f=i),(E=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=E}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(uf={focusedElem:l,selectionRange:e},In=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cgl&&(i=gl,gl=X,X=i);var r=rs(c,X),s=rs(c,gl);if(r&&s&&(E.rangeCount!==1||E.anchorNode!==r.node||E.anchorOffset!==r.offset||E.focusNode!==s.node||E.focusOffset!==s.offset)){var y=A.createRange();y.setStart(r.node,r.offset),E.removeAllRanges(),X>gl?(E.addRange(y),E.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),E.addRange(y))}}}}for(A=[],E=c;E=E.parentNode;)E.nodeType===1&&A.push({element:E,left:E.scrollLeft,top:E.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Vc,Vc=null;var n=Ae,i=ne;if(Ql=0,Ra=Ae=null,ne=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{M.p=u,p.T=a,Co(l,t)}}function Ro(l,t,e){t=Mt(e,t),t=pc(l.stateNode,t,2),l=Se(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function ml(l,t,e){if(l.tag===3)Ro(l,l,e);else for(;t!==null;){if(t.tag===3){Ro(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(_e===null||!_e.has(a))){l=Mt(e,l),e=Rd(2),a=Se(t,e,2),a!==null&&(xd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function wc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Gc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,Sl===l&&(el&e)===e&&(Dl===4||Dl===3&&(el&62914560)===el&&300>D()-Rn?(dl&2)===0&&xa(l,0):Xc|=e,Ha===el&&(Ha=0)),Qt(l)}function xo(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),xo(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),xo(l,e)}function Sv(l,t){return ea(l,t)}var Qn=null,Ba=null,kc=!1,Zn=!1,Wc=!1,Me=0;function Qt(l){l!==Ba&&l.next===null&&(Ba===null?Qn=Ba=l:Ba=Ba.next=l),Zn=!0,kc||(kc=!0,Ev())}function Du(l,t){if(!Wc&&Zn){Wc=!0;do for(var e=!1,a=Qn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-rt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Ku(a,a===Sl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||ka(a,n)||(e=!0,Go(a,n));a=a.next}while(e);Wc=!1}}function bv(){qo()}function qo(){Zn=kc=!1;var l=0;Me!==0&&Nv()&&(l=Me);for(var t=D(),e=null,a=Qn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Qn=u:e.next=u,u===null&&(Ba=e)):(e=a,(l!==0||(n&3)!==0)&&(Zn=!0)),a=u}Ql!==0&&Ql!==5||Du(l),Me!==0&&(Me=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var z=f.transferSize,A=f.initiatorType;z&&wo(A)&&(f=f.responseEnd,i+=z*(f"u"?null:document;function nr(l,t,e){var a=Ya;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Gv(l){ie.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ie.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ie.L(l,t,e);var a=Ya;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Ga(l);break;case"script":n=Xa(l)}Ht.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Zv(l,t){ie.m(l,t);var e=Ya;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Xa(l)}if(!Ht.has(n)&&(l=R({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ie.S(l,t,e);var a=Ya;if(a&&l){var u=ca(a).hoistableStyles,n=Ga(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&rf(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(h,z){f.onload=h,f.onerror=z}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,wn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ie.X(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ie.M(l,t);var e=Ya;if(e&&l){var a=ca(e).hoistableScripts,u=Xa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&mf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=Z.current)?Jn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Ga(e.href),e=ca(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Ga(e.href);var n=ca(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Xa(e),e=ca(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Ga(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Xa(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),wn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Ga(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=cr(e),(u=Ht.get(u))&&rf(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,wn(n,e.precedence,l),t.instance=n;case"script":return n=Xa(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=R({},e),mf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wn(a,e.precedence,l));return t.instance}function wn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function kv(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Ga(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=cr(a),(u=Ht.get(u))&&rf(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var vf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&Fn(l,l.stylesheets),0vf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var $n=null;function Fn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,$n=new Map,t.forEach($v,l),$n=null,Wn.call(l))}function $v(l,t){if(!(t.state.loading&4)){var e=$n.get(l);if(e)var a=e.get(null);else{e=new Map,$n.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(C){console.error(C)}}return o(),Tf.exports=yy(),Tf.exports}var gy=hy();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const C=o.camera;if(_l.camera==="head")o.controls.target.set(0,10,0),C.position.set(10,12,18);else{o.controls.target.set(0,0,0);const j=48;_l.camera==="front"?C.position.set(0,0,j):_l.camera==="back"?C.position.set(0,0,-j):C.position.set(23,7,42)}C.lookAt(o.controls.target),C.updateProjectionMatrix(),o.controls.update()}function Gr(){_l.syncing=!0;try{_l.viewers.forEach(o=>Sy(o.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===_l.camera))}function by(o){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:C}of _l.viewers)C!==o&&(C.camera.position.copy(o.camera.position),C.camera.quaternion.copy(o.camera.quaternion),C.camera.zoom=o.camera.zoom,C.controls.target.copy(o.controls.target),C.camera.updateProjectionMatrix(),C.controls.update())}finally{_l.syncing=!1}}}function Ey(o,C,j){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let N;try{N=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),N.controls.enablePan=!1,N.controls.enableDamping=!1,N.controls.minDistance=12,N.controls.maxDistance=120,N.controls.addEventListener("change",()=>by(N));const L=new ResizeObserver(()=>{!N.disposed&&o.clientWidth&&o.clientHeight&&(N.width=o.clientWidth,N.height=o.clientHeight)});L.observe(o),_l.viewers.push({viewer:N,observer:L}),Promise.resolve(N.loadSkin(C.url,{model:"default"})).then(()=>{j!==_l.generation||N.disposed||(N.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{j===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{N&&!N.disposed&&N.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function zy(o,C){Ey(o,C,_l.generation),Gr();const j=_l.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||_l.viewers.at(-1);return()=>{j&&(j.observer.disconnect(),j.viewer.dispose(),j.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==j))}}function py(o,C,j){const v=_l.camera!==o;Object.assign(_l,{camera:o,outerLayer:C,uvOnly:j}),v&&Gr(),_l.viewers.forEach(({viewer:N})=>{N.playerObject.skin.setOuterLayerVisible(C),N.renderPaused=j})}async function ii(o,C,j){const v=await fetch("/api/meat-model/"+o,C===void 0?{signal:j}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C),signal:j}),N=await v.json();if(!v.ok)throw Error(N.error||"预选服务暂不可用");return N}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const C={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别 meat",complete:"已完成",failed:"失败"},j=o?.progress;return(C[o?.stage]||"正在预选")+(j?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型"}[j.variant]||"DINO+局部特征"} ${j.fold}/${j.total} 组`:j?.remaining?` · 剩余 ${j.remaining} 张`:j?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,C]=V.useState(null),[j,v]=V.useState(""),[N,L]=V.useState(!1),k=V.useRef(!0),nl=V.useRef(null),U=V.useRef(!1),T=async()=>{try{const Y=await ii("status");k.current&&(C(Y),v(""))}catch(Y){k.current&&v(Y.message)}};V.useEffect(()=>{k.current=!0,T();const Y=()=>T();return window.addEventListener("meat-saved",Y),nl.current=setInterval(T,1e4),()=>{k.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",Y)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const Y=await ii("train",{});k.current&&C(vl=>({...vl,training:Y}))}catch(Y){k.current&&v(Y.message)}finally{U.current=!1,k.current&&(L(!1),T())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"仅在点击按钮时训练并更新六面+表面结构模型;保存标注不会自动训练。已保存的细分类参与辅助训练,未细标格仍用于二分类。"}),o?.dataset&&g.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:R,disabled:N||Q||!o?.active||o?.dataset?.count<3,children:N?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&g.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是新皮肤准确率,预选仍需人工检查。"]}),!!o?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((Y,vl)=>g.jsxs("p",{children:[Y.id,":",Y.reason]},vl))]}),j&&g.jsx("p",{className:"meat-warning",role:"alert",children:j})]})}function Uy({data:o,disabled:C,onStart:j,onEnd:v,onApply:N}){const[L,k]=V.useState(!1),[nl,U]=V.useState(""),[T,Q]=V.useState(""),R=V.useRef(!0),Y=V.useRef(null),vl=V.useRef(!1);V.useEffect(()=>(R.current=!0,()=>{R.current=!1,Y.current?.abort()}),[]);const Al=async()=>{if(vl.current)return;vl.current=!0,k(!0),Q(""),U("正在请求预选…"),j(),Y.current=new AbortController;const Nl=Y.current.signal;try{let K=await ii("predict",{key:o.key,skin_revision:o.skin_revision},Nl);for(;!Xr(K.stage);){if(!R.current||(U(Qr(K)),await new Promise(bl=>setTimeout(bl,1500)),!R.current))return;K=await ii("job?id="+encodeURIComponent(K.id),void 0,Nl)}if(K.stage==="failed")throw Error(K.error||"预选失败,请稍后重试");if(K.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");R.current&&(N(K.prediction),U(`预选来自 ${K.prediction.model_id} · ${K.prediction.selected.length} 格。请检查并修改,再保存。`))}catch(K){R.current&&K.name!=="AbortError"&&(Q(K.message),U(""))}finally{vl.current=!1,R.current&&(k(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:Al,disabled:C||L||o.model!=="classic",children:L?"模型预选中…":"模型预选"}),g.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),nl&&g.jsx("p",{role:"status",children:nl}),T&&g.jsx("p",{role:"alert",className:"meat-warning",children:T})]})}const _y=V.lazy(()=>Yr(()=>import("./SkinEditor-TQinzOLu.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=V.lazy(()=>Yr(()=>import("./MeatEditor-WUbpTXnd.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ni=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,C)=>C==="all"||C==="perfect"&&!!o.perfect||C==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||C==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||C==="best"&&!!o.best||C==="ordinary"&&!!o.best&&!o.perfect||o.rejection===C,Br=o=>o.version==="original"?"原版":o.version;async function Za(o,C){const j=await fetch(o,C===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C)}),v=await j.json();if(!j.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const C=V.useRef(null);return V.useEffect(()=>zy(C.current,o),[o.url]),g.jsxs("div",{className:"skin-stage",ref:C,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,C]=V.useState([]),[j,v]=V.useState(null),[N,L]=V.useState("pending"),[k,nl]=V.useState("all"),[U,T]=V.useState(""),[Q,R]=V.useState(""),[Y,vl]=V.useState(new Set),[Al,Nl]=V.useState([]),[K,bl]=V.useState(!1),[Gl,Xl]=V.useState(null),[Fl,Et]=V.useState("angle"),[Zl,I]=V.useState(!0),[Ul,zt]=V.useState(!1),[et,Kl]=V.useState(null),[Ml,pt]=V.useState(null),[il,Il]=V.useState(null),[p,M]=V.useState(!1),H=V.useRef(!1),sl=V.useRef(null),ol=V.useRef(null),d=V.useRef(null),m=o.find(b=>b.key===j),O=(b,D=N,tl=U,Pl=Q,Ol=k)=>(!tl||ni(b)===tl)&&b.id.toLowerCase().includes(Pl.trim().toLowerCase())&&(D==="all"||D==="pending"&&b.results.length>0&&!Re(b)||D==="done"&&Re(b)&&My(b,Ol)||D==="rejected"&&!!b.rejection||D==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,Z=(b,D=!1)=>Xl({message:b,error:D}),F=(b,D=!0)=>{H.current||(D&&j&&j!==b&&Nl(tl=>[...tl,j]),v(b))},Rl=(b=N,D=U,tl=Q,Pl=Y)=>o.find(Ol=>O(Ol,b,D,tl)&&!Pl.has(Ol.key))?.key||null,El=(b=o,D=Y)=>{const tl=b.filter(Ol=>O(Ol)&&!D.has(Ol.key)&&Ol.key!==j),Pl=b.findIndex(Ol=>Ol.key===j);F((tl.find(Ol=>b.indexOf(Ol)>Pl)||tl[0])?.key||null)};async function ce(b=!1){if(!H.current){H.current=!0,bl(!0);try{const D=await Za(b?"/api/refresh":"/api/state",b?{}:void 0);C(D.items),v(D.items.find(tl=>tl.key===j&&O(tl))?.key||D.items.find(tl=>O(tl)&&!Y.has(tl.key))?.key||null),b&&Z("目录已刷新")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function Tt(b,D,tl){if(!(H.current||!m)){H.current=!0,bl(!0);try{const Pl=await Za("/api/"+b,{key:m.key,revision:m.revision,result:D?.name,reason:typeof D=="string"?D:void 0,png:tl}),Ol=o.map(Ja=>Ja.key===j?Pl.item:Ja);C(Ol);const at=new Set(Y);at.delete(j),vl(at),H.current=!1,pt(null),b!=="clear"&&El(Ol,at),Z(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}async function la(b=m){if(!(H.current||!b?.perfect)){H.current=!0,bl(!0);try{const D=await Za("/api/meat?key="+encodeURIComponent(b.key)),tl=await Za(`/api/meat-semantic?key=${encodeURIComponent(b.key)}`);M(!1),Il({...D,semantic:tl})}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}const Va=()=>{H.current||p&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(Il(null),M(!1))};async function Zt(b){if(!(H.current||!il)){H.current=!0,bl(!0);try{const D=await Za("/api/meat-semantic",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,semantic_revision:il.semantic.semantic_revision,labels:b});Il({...il,semantic:D}),M(!1),window.dispatchEvent(new Event("meat-saved")),Z("细分类已保存,meat 标注保持不变")}catch(D){Z(D.message,!0)}finally{H.current=!1,bl(!1)}}}async function La(b,D,tl){if(!(H.current||!il)){H.current=!0,bl(!0);try{const Pl=await Za("/api/meat",{key:il.key,revision:il.revision,skin_revision:il.skin_revision,meat_revision:il.meat_revision,selected:b,assistance:tl});window.dispatchEvent(new Event("meat-saved"));const Ol=o.map(at=>at.key===il.key?Pl.item:at);if(C(Ol),Il(null),M(!1),Z("meat 已保存 · "+il.id+" · "+b.length+" 格"),H.current=!1,D){const at=Ol.findIndex(fe=>fe.key===il.key),aa=[...Ol.slice(at+1),...Ol.slice(0,at)].find(fe=>fe.perfect&&fe.meat_status!=="saved"&&(!U||ni(fe)===U)&&fe.id.toLowerCase().includes(Q.trim().toLowerCase()));aa?(F(aa.key),await la(aa)):Z("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Pl){Z(Pl.message,!0)}finally{H.current=!1,bl(!1)}}}function ta(){if(H.current||!m)return;const b=new Set(Y);b.add(j),vl(b),El(o,b)}function Qu(){!H.current&&Al.length&&(v(Al.at(-1)),Nl(Al.slice(0,-1)))}V.useEffect(()=>{ce()},[]),V.useEffect(()=>py(Fl,Zl,Ul),[Fl,Zl,Ul,j]),V.useEffect(()=>{if(!Gl)return;const b=setTimeout(()=>Xl(null),Gl.error?8e3:3500);return()=>clearTimeout(b)},[Gl]),V.useEffect(()=>{et&&sl.current?.showModal()},[et]),V.useEffect(()=>{Ml&&ol.current?.showModal()},[Ml]),V.useEffect(()=>{il&&d.current?.showModal()},[il]),V.useEffect(()=>{const b=D=>{if(!(K||et||Ml||il||D.ctrlKey||D.metaKey||D.altKey||D.target.closest("input,select,textarea,[contenteditable]"))){if(D.key.toLowerCase()==="s")D.preventDefault(),ta();else if(D.key==="ArrowLeft")D.preventDefault(),Qu();else if(D.key==="ArrowRight")D.preventDefault(),El();else if(/^[1-9]$/.test(D.key)){const tl=m?.results[+D.key-1];tl&&(D.preventDefault(),Tt("choose",tl))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Bt=o.filter(b=>!U||ni(b)===U),xe=Bt.filter(Re).length,ea=xe+Bt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Bt.filter(Re).length,pending:Bt.filter(b=>b.results.length&&!Re(b)).length,rejected:Bt.filter(b=>b.rejection).length,all:Bt.length,no_results:Bt.filter(b=>!b.results.length).length},ci=b=>{H.current||(L(b),F(Rl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[xe," / ",ea]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${xe/(ea||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:K,onClick:()=>ce(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,D])=>g.jsxs("button",{"data-filter":b,disabled:K,className:N===b?"active":"",onClick:()=>ci(b),children:[D," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:K,value:U,onChange:b=>{T(b.target.value),F(Rl(N,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ni))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:K,value:Q,onChange:b=>{R(b.target.value),F(Rl(N,U,b.target.value))}})]}),N==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:K,value:k,onChange:b=>{const D=b.target.value;nl(D),F(o.find(tl=>O(tl,"done",U,Q,D)&&!Y.has(tl.key))?.key||null)},children:Object.entries(Oy).map(([b,D])=>g.jsxs("option",{value:b,children:[D," ·"," ",o.filter(tl=>O(tl,"done",U,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(Ty,{}),g.jsx("main",{children:m?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:m.folder}),g.jsx("h2",{id:"itemId",children:m.id}),g.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:K,value:j,onChange:b=>{const D=new Set(Y);D.delete(b.target.value),vl(D),F(b.target.value)},children:J.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,D,tl])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",D]}),g.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!tl,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:tl,title:m.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:tl||void 0,alt:D})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!tl,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:K||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:K||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Kl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:K,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),g.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:K,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,D])=>g.jsx("button",{"data-camera":b,className:Fl===b?"active":"",onClick:()=>Et(b),children:D},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:b=>I(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Ul,onClick:()=>zt(!Ul),children:Ul?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Ul?" uv-only":""),children:[m.results.map((b,D)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:Br(b)}),g.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":D+1})]}),g.jsx(jy,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Kl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:K||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:K||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:K,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:K,onClick:()=>{vl(new Set),L("pending"),T(""),R(""),F(Rl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:K||!Al.length,onClick:Qu,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:K||!m,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",Y.size," 项 · 忽略不保存"]})]}),Gl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(Gl.error?" error":""),children:Gl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>Kl(null),onClick:b=>{b.target===b.currentTarget&&Kl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),K||pt(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:()=>pt(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?g.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_y,{textureUrl:Ml.url,busy:K,onError:b=>Z(b,!0),onSubmit:b=>Tt("repair",Ml.result,b)})})})]}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]}),il&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),Va()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["meat 标注 · ",il.id," · ",il.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:Va,children:"关闭 ×"})]}),g.jsx(V.Suspense,{fallback:g.jsx("p",{children:"正在加载 meat 标注器…"}),children:g.jsx(Ay,{data:il,busy:K,onSave:La,onSaveSemantic:Zt,onDirty:M},il.key)}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]})]})}gy.createRoot(document.getElementById("root")).render(g.jsx(Dy,{}));export{Uy as M,Ny as R,Mf as a,ry as b,cy as g,g as j,V as r}; diff --git a/best_annotator/static/assets/index-DqXMzOA0.js b/best_annotator/static/assets/index-DqXMzOA0.js new file mode 100644 index 0000000000000000000000000000000000000000..650f6aa681441fd14ecf9a63b89b12fb02e54cb6 --- /dev/null +++ b/best_annotator/static/assets/index-DqXMzOA0.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-DeZxzTfI.js","assets/OrbitControls-CHt0YeD1.js","assets/SkinEditor-BzPsKcct.css","assets/MeatEditor-C-IGVOEE.js"])))=>i.map(i=>d[i]); +(function(){const U=document.createElement("link").relList;if(U&&U.supports&&U.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const V of D)if(V.type==="childList")for(const k of V.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&v(k)}).observe(document,{childList:!0,subtree:!0});function M(D){const V={};return D.integrity&&(V.integrity=D.integrity),D.referrerPolicy&&(V.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?V.credentials="include":D.crossOrigin==="anonymous"?V.credentials="omit":V.credentials="same-origin",V}function v(D){if(D.ep)return;D.ep=!0;const V=M(D);fetch(D.href,V)}})();const ny="modulepreload",iy=function(m){return"/"+m},_r={},Br=function(U,M,v){let D=Promise.resolve();if(M&&M.length>0){let N=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(H=>({status:"fulfilled",value:H}),H=>({status:"rejected",reason:H}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),nl=k?.nonce||k?.getAttribute("nonce");D=N(M.map(T=>{if(T=iy(T),T in _r)return;_r[T]=!0;const Q=T.endsWith(".css"),H=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${H}`))return;const Y=document.createElement("link");if(Y.rel=Q?"stylesheet":ny,Q||(Y.as="script"),Y.crossOrigin="",Y.href=T,nl&&Y.setAttribute("nonce",nl),document.head.appendChild(Y),Q)return new Promise((ml,Al)=>{Y.addEventListener("load",ml),Y.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function V(k){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=k,window.dispatchEvent(nl),!nl.defaultPrevented)throw k}return D.then(k=>{for(const nl of k||[])nl.status==="rejected"&&V(nl.reason);return U().catch(V)})};function cy(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var zf={exports:{}},Gu={};var Ar;function fy(){if(Ar)return Gu;Ar=1;var m=Symbol.for("react.transitional.element"),U=Symbol.for("react.fragment");function M(v,D,V){var k=null;if(V!==void 0&&(k=""+V),D.key!==void 0&&(k=""+D.key),"key"in D){V={};for(var nl in D)nl!=="key"&&(V[nl]=D[nl])}else V=D;return D=V.ref,{$$typeof:m,type:v,key:k,ref:D!==void 0?D:null,props:V}}return Gu.Fragment=U,Gu.jsx=M,Gu.jsxs=M,Gu}var Or;function sy(){return Or||(Or=1,zf.exports=fy()),zf.exports}var g=sy(),Ef={exports:{}},W={};var Mr;function dy(){if(Mr)return W;Mr=1;var m=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),k=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),Y=Symbol.iterator;function ml(d){return d===null||typeof d!="object"?null:(d=Y&&d[Y]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nl=Object.assign,K={};function pl(d,r,O){this.props=d,this.context=r,this.refs=K,this.updater=O||Al}pl.prototype.isReactComponent={},pl.prototype.setState=function(d,r){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,r,"setState")},pl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Gl(){}Gl.prototype=pl.prototype;function Xl(d,r,O){this.props=d,this.context=r,this.refs=K,this.updater=O||Al}var Fl=Xl.prototype=new Gl;Fl.constructor=Xl,Nl(Fl,pl.prototype),Fl.isPureReactComponent=!0;var bt=Array.isArray;function Zl(){}var P={H:null,A:null,T:null,S:null},Ul=Object.prototype.hasOwnProperty;function zt(d,r,O){var R=O.ref;return{$$typeof:m,type:d,key:r,ref:R!==void 0?R:null,props:O}}function et(d,r){return zt(d.type,r,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===m}function Ml(d){var r={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return r[O]})}var Et=/\/+/g;function Sl(d,r){return typeof d=="object"&&d!==null&&d.key!=null?Ml(""+d.key):r.toString(36)}function Pl(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(r){d.status==="pending"&&(d.status="fulfilled",d.value=r)},function(r){d.status==="pending"&&(d.status="rejected",d.reason=r)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,r,O,R,w){var L=typeof d;(L==="undefined"||L==="boolean")&&(d=null);var I=!1;if(d===null)I=!0;else switch(L){case"bigint":case"string":case"number":I=!0;break;case"object":switch(d.$$typeof){case m:case U:I=!0;break;case Q:return I=d._init,p(I(d._payload),r,O,R,w)}}if(I)return w=w(d),I=R===""?"."+Sl(d,0):R,bt(w)?(O="",I!=null&&(O=I.replace(Et,"$&/")+"/"),p(w,r,O,"",function(fe){return fe})):w!=null&&(Kl(w)&&(w=et(w,O+(w.key==null||d&&d.key===w.key?"":(""+w.key).replace(Et,"$&/")+"/")+I)),r.push(w)),1;I=0;var Rl=R===""?".":R+":";if(bt(d))for(var bl=0;bl>>1,dl=p[fl];if(0>>1;flD(O,C))RD(w,O)?(p[fl]=w,p[R]=C,fl=R):(p[fl]=O,p[r]=C,fl=r);else if(RD(w,C))p[fl]=w,p[R]=C,fl=R;else break l}}return j}function D(p,j){var C=p.sortIndex-j.sortIndex;return C!==0?C:p.id-j.id}if(m.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var V=performance;m.unstable_now=function(){return V.now()}}else{var k=Date,nl=k.now();m.unstable_now=function(){return k.now()-nl}}var N=[],T=[],Q=1,H=null,Y=3,ml=!1,Al=!1,Nl=!1,K=!1,pl=typeof setTimeout=="function"?setTimeout:null,Gl=typeof clearTimeout=="function"?clearTimeout:null,Xl=typeof setImmediate<"u"?setImmediate:null;function Fl(p){for(var j=M(T);j!==null;){if(j.callback===null)v(T);else if(j.startTime<=p)v(T),j.sortIndex=j.expirationTime,U(N,j);else break;j=M(T)}}function bt(p){if(Nl=!1,Fl(p),!Al)if(M(N)!==null)Al=!0,Zl||(Zl=!0,Ml());else{var j=M(T);j!==null&&Pl(bt,j.startTime-p)}}var Zl=!1,P=-1,Ul=5,zt=-1;function et(){return K?!0:!(m.unstable_now()-ztp&&et());){var fl=H.callback;if(typeof fl=="function"){H.callback=null,Y=H.priorityLevel;var dl=fl(H.expirationTime<=p);if(p=m.unstable_now(),typeof dl=="function"){H.callback=dl,Fl(p),j=!0;break t}H===M(N)&&v(N),Fl(p)}else v(N);H=M(N)}if(H!==null)j=!0;else{var d=M(T);d!==null&&Pl(bt,d.startTime-p),j=!1}}break l}finally{H=null,Y=C,ml=!1}j=void 0}}finally{j?Ml():Zl=!1}}}var Ml;if(typeof Xl=="function")Ml=function(){Xl(Kl)};else if(typeof MessageChannel<"u"){var Et=new MessageChannel,Sl=Et.port2;Et.port1.onmessage=Kl,Ml=function(){Sl.postMessage(null)}}else Ml=function(){pl(Kl,0)};function Pl(p,j){P=pl(function(){p(m.unstable_now())},j)}m.unstable_IdlePriority=5,m.unstable_ImmediatePriority=1,m.unstable_LowPriority=4,m.unstable_NormalPriority=3,m.unstable_Profiling=null,m.unstable_UserBlockingPriority=2,m.unstable_cancelCallback=function(p){p.callback=null},m.unstable_forceFrameRate=function(p){0>p||125fl?(p.sortIndex=C,U(T,p),M(N)===null&&p===M(T)&&(Nl?(Gl(P),P=-1):Nl=!0,Pl(bt,C-fl))):(p.sortIndex=dl,U(N,p),Al||ml||(Al=!0,Zl||(Zl=!0,Ml()))),p},m.unstable_shouldYield=et,m.unstable_wrapCallback=function(p){var j=Y;return function(){var C=Y;Y=j;try{return p.apply(this,arguments)}finally{Y=C}}}})(_f)),_f}var Nr;function ry(){return Nr||(Nr=1,Tf.exports=oy()),Tf.exports}var Af={exports:{}},Il={};var Ur;function my(){if(Ur)return Il;Ur=1;var m=Of();function U(N){var T="https://react.dev/errors/"+N;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m)}catch(U){console.error(U)}}return m(),Af.exports=my(),Af.exports}var Hr;function yy(){if(Hr)return Xu;Hr=1;var m=ry(),U=Of(),M=vy();function v(l){var t="https://react.dev/errors/"+l;if(1dl||(l.current=fl[dl],fl[dl]=null,dl--)}function O(l,t){dl++,fl[dl]=l.current,l.current=t}var R=d(null),w=d(null),L=d(null),I=d(null);function Rl(l,t){switch(O(L,t),O(w,l),O(R,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?wo(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=wo(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}r(R),O(R,l)}function bl(){r(R),r(w),r(L)}function fe(l){l.memoizedState!==null&&O(I,l);var t=R.current,e=Wo(t,l.type);t!==e&&(O(w,l),O(R,e))}function pt(l){w.current===l&&(r(R),r(w)),I.current===l&&(r(I),xu._currentValue=C)}var la,Va;function Qt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==h[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Qt(e):""}function Zt(l,t){switch(l.tag){case 26:case 27:case 5:return Qt(l.type);case 16:return Qt("Lazy");case 13:return l.child!==t&&t!==null?Qt("Suspense Fallback"):Qt("Suspense");case 19:return Qt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Qt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Zt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,La=m.unstable_scheduleCallback,Ka=m.unstable_cancelCallback,b=m.unstable_shouldYield,q=m.unstable_requestPaint,J=m.unstable_now,lt=m.unstable_getCurrentPriorityLevel,Ol=m.unstable_ImmediatePriority,Tt=m.unstable_UserBlockingPriority,se=m.unstable_NormalPriority,Ja=m.unstable_LowPriority,Vt=m.unstable_IdlePriority,Qr=m.log,Zr=m.unstable_setDisableYieldValue,wa=null,dt=null;function de(l){if(typeof Qr=="function"&&Zr(l),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(wa,l)}catch{}}var ot=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Qu=256,Zu=262144,Vu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Lu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function Wa(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mf(){var l=Vu;return Vu<<=1,(Vu&62914560)===0&&(Vu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function ka(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,h=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Xf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&wu(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function da(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,zi=null,ku=null;function wf(){if(ku)return ku;var l,t=zi,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),Pf=" ",ls=!1;function ts(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function es(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var va=!1;function Dm(l,t){switch(l){case"compositionend":return es(t);case"keypress":return t.which!==32?null:(ls=!0,Pf);case"textInput":return l=t.data,l===Pf&&ls?null:l;default:return null}}function Nm(l,t){if(va)return l==="compositionend"||!Ai&&ts(l,t)?(l=wf(),ku=zi=re=null,va=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=ds(e)}}function rs(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?rs(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function ms(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=wu(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=wu(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ya=null,Di=null,iu=null,Ni=!1;function vs(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ya==null||ya!==wu(a)||(a=ya,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Vn(Di,"onSelect"),0>=i,u-=i,Bt=1<<32-ot(t)+u|e<F?(al=B,B=null):al=B.sibling;var cl=S(o,B,y[F],_);if(cl===null){B===null&&(B=al);break}l&&B&&cl.alternate===null&&t(o,B),s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl,B=al}if(F===y.length)return e(o,B),ul&&Wt(o,F),G;if(B===null){for(;FF?(al=B,B=null):al=B.sibling;var Re=S(o,B,cl.value,_);if(Re===null){B===null&&(B=al);break}l&&B&&Re.alternate===null&&t(o,B),s=n(Re,s,F),il===null?G=Re:il.sibling=Re,il=Re,B=al}if(cl.done)return e(o,B),ul&&Wt(o,F),G;if(B===null){for(;!cl.done;F++,cl=y.next())cl=A(o,cl.value,_),cl!==null&&(s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl);return ul&&Wt(o,F),G}for(B=a(B);!cl.done;F++,cl=y.next())cl=z(B,o,F,cl.value,_),cl!==null&&(l&&cl.alternate!==null&&B.delete(cl.key===null?F:cl.key),s=n(cl,s,F),il===null?G=cl:il.sibling=cl,il=cl);return l&&B.forEach(function(uy){return t(o,uy)}),ul&&Wt(o,F),G}function hl(o,s,y,_){if(typeof y=="object"&&y!==null&&y.type===Nl&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case ml:l:{for(var G=y.key;s!==null;){if(s.key===G){if(G=y.type,G===Nl){if(s.tag===7){e(o,s.sibling),_=u(s,y.props.children),_.return=o,o=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ul&&we(G)===s.type){e(o,s.sibling),_=u(s,y.props),ru(_,y),_.return=o,o=_;break l}e(o,s);break}else t(o,s);s=s.sibling}y.type===Nl?(_=Ze(y.props.children,o.mode,_,y.key),_.return=o,o=_):(_=nn(y.type,y.key,y.props,null,o.mode,_),ru(_,y),_.return=o,o=_)}return i(o);case Al:l:{for(G=y.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===y.containerInfo&&s.stateNode.implementation===y.implementation){e(o,s.sibling),_=u(s,y.children||[]),_.return=o,o=_;break l}else{e(o,s);break}else t(o,s);s=s.sibling}_=Bi(y,o.mode,_),_.return=o,o=_}return i(o);case Ul:return y=we(y),hl(o,s,y,_)}if(Pl(y))return x(o,s,y,_);if(Ml(y)){if(G=Ml(y),typeof G!="function")throw Error(v(150));return y=G.call(y),X(o,s,y,_)}if(typeof y.then=="function")return hl(o,s,mn(y),_);if(y.$$typeof===Xl)return hl(o,s,sn(o,y),_);vn(o,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,s!==null&&s.tag===6?(e(o,s.sibling),_=u(s,y),_.return=o,o=_):(e(o,s),_=qi(y,o.mode,_),_.return=o,o=_),i(o)):e(o,s)}return function(o,s,y,_){try{ou=0;var G=hl(o,s,y,_);return Oa=null,G}catch(B){if(B===Aa||B===on)throw B;var il=mt(29,B,null,o.mode);return il.lanes=_,il.return=o,il}}}var ke=Bs(!0),Ys=Bs(!1),ge=!1;function ki(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $i(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(sl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=un(l),Es(l,null,e),t}return an(l,a,t,e),un(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=_a;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,h=f.next;f.next=null,i===null?n=h:i.next=h,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=h:c.next=h,E.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,E=h=f=null,c=n;do{var S=c.lane&-536870913,z=S!==c.lane;if(z?(el&S)===S:(a&S)===S){S!==0&&S===Ta&&(Ii=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var x=l,X=c;S=t;var hl=e;switch(X.tag){case 1:if(x=X.payload,typeof x=="function"){A=x.call(hl,A,S);break l}A=x;break l;case 3:x.flags=x.flags&-65537|128;case 0:if(x=X.payload,S=typeof x=="function"?x.call(hl,A,S):x,S==null)break l;A=H({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,z&&(l.flags|=8192),z=u.callbacks,z===null?u.callbacks=[S]:z.push(S))}else z={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(h=E=z,f=A):E=E.next=z,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;z=c,c=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(!0);E===null&&(f=A),u.baseState=f,u.firstBaseUpdate=h,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Gs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Xs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,gc(l,!1,t,e);try{var f=u(),h=p.S;if(h!==null&&h(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=wm(f,a);Su(l,t,E,St(l))}else Su(l,t,a,St(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},St())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=Sd(l).queue;gd(l,u,t,C,e===null?Pm:function(){return bd(l),e(a)})}function Sd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function bd(l){var t=Sd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},St())}function hc(){return Wl(xu)}function zd(){return Hl().memoizedState}function Ed(){return Hl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=St();l=Se(e);var a=be(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=St();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?Td(t,e):(e=Ri(l,t,e,a),e!==null&&(st(e,l,a),_d(e,t,a)))}function pd(l,t,e){var a=St();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))Td(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,rt(c,i))return an(l,t,u,0),gl===null&&en(),!1}catch{}if(e=Ri(l,t,u,a),e!==null)return st(e,l,a),_d(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:kc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Ri(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===$||t!==null&&t===$}function Td(l,t){ja=gn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function _d(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}var bu={readContext:Wl,use:zn,useCallback:jl,useContext:jl,useEffect:jl,useImperativeHandle:jl,useLayoutEffect:jl,useInsertionEffect:jl,useMemo:jl,useReducer:jl,useRef:jl,useState:jl,useDebugValue:jl,useDeferredValue:jl,useTransition:jl,useSyncExternalStore:jl,useId:jl,useHostTransitionStatus:jl,useFormState:jl,useActionState:jl,useOptimistic:jl,useMemoCache:jl,useCacheRefresh:jl};bu.useEffectEvent=jl;var Ad={readContext:Wl,use:zn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:fd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,pn(4194308,4,rd.bind(null,t,l),e)},useLayoutEffect:function(l,t){return pn(4194308,4,l,t)},useInsertionEffect:function(l,t){pn(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,$,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=pd.bind(null,$,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=tt();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=gd.bind(null,$,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=$,u=tt();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),gl===null)throw Error(v(349));(el&127)!==0||Js(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,fd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Na(9,{destroy:void 0},ws.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=gl.identifierPrefix;if(ul){var e=Yt,a=Bt;e=(a&~(1<<32-ot(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Sn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return El(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=L.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Ko(l.nodeValue,e)),l||ye(t,!0)}else l=Ln(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return El(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;El(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return El(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;El(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),El(t),null);case 4:return bl(),l===null&&Pc(t.stateNode.containerInfo),El(t),null;case 10:return $t(t.type),El(t),null;case 19:if(r(Cl),a=t.memoizedState,a===null)return El(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)Eu(a,!1);else{if(Dl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=hn(l),n!==null){for(t.flags|=128,Eu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)ps(e,l),e=e.sibling;return O(Cl,Cl.current&1|2),ul&&Wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&J()>Rn&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304)}else{if(!u)if(l=hn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),Eu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return El(t),null}else 2*J()-a.renderingStartTime>Rn&&e!==536870912&&(t.flags|=128,u=!0,Eu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=J(),l.sibling=null,e=Cl.current,O(Cl,u?e&1|2:e&1),ul&&Wt(t,a.treeForkCount),l):(El(t),null);case 22:case 23:return yt(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(El(t),t.subtreeFlags&6&&(t.flags|=8192)):El(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&r(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),$t(xl),El(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return $t(xl),bl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(yt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return r(Cl),null;case 4:return bl(),null;case 10:return $t(t.type),null;case 22:case 23:return yt(t),lc(),l!==null&&r(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return $t(xl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:$t(xl),bl();break;case 26:case 27:case 5:pt(t);break;case 4:bl();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:r(Cl);break;case 10:$t(t.type);break;case 22:case 23:yt(t),lc(),l!==null&&r(Je);break;case 24:$t(xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){rl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,h=c;try{h()}catch(E){rl(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){rl(t,t.return,E)}}function $d(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Xs(t,e)}catch(a){rl(l,l.return,a)}}}function Fd(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){rl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){rl(l,t,u)}}function Gt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){rl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){rl(l,t,u)}else e.current=null}function Id(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){rl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[at]=t}catch(u){rl(l,l.return,u)}}function Pd(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function Hc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||Pd(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Rc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Rc(l,t,e),l=l.sibling;l!==null;)Rc(l,t,e),l=l.sibling}function Nn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Nn(l,t,e),l=l.sibling;l!==null;)Nn(l,t,e),l=l.sibling}function lo(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[at]=e}catch(n){rl(l,l.return,n)}}var te=!1,Yl=!1,xc=!1,to=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function cv(l,t){if(l=l.containerInfo,ef=Fn,l=ms(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,h=0,E=0,A=l,S=null;t:for(;;){for(var z;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(z=A.firstChild)!==null;)S=A,A=z;for(;;){if(A===l)break t;if(S===e&&++h===u&&(c=i),S===n&&++E===a&&(f=i),(z=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=z}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},Fn=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=fr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;chl&&(i=hl,hl=X,X=i);var o=os(c,X),s=os(c,hl);if(o&&s&&(z.rangeCount!==1||z.anchorNode!==o.node||z.anchorOffset!==o.offset||z.focusNode!==s.node||z.focusOffset!==s.offset)){var y=A.createRange();y.setStart(o.node,o.offset),z.removeAllRanges(),X>hl?(z.addRange(y),z.extend(s.node,s.offset)):(y.setEnd(s.node,s.offset),z.addRange(y))}}}}for(A=[],z=c;z=z.parentNode;)z.nodeType===1&&A.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Ql=0,xa=Oe=null,ie=0,(sl&6)!==0)throw Error(v(331));var c=sl;if(sl|=4,mo(n.current),so(n,n.current,i,e),sl=c,Du(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,p.T=a,Uo(l,t)}}function Ho(l,t,e){t=Mt(e,t),t=Ec(l.stateNode,t,2),l=be(l,t,2),l!==null&&(ka(l,2),Xt(l))}function rl(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Hd(2),a=be(t,e,2),a!==null&&(Rd(e,a,t,l),ka(a,2),Xt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,gl===l&&(el&e)===e&&(Dl===4||Dl===3&&(el&62914560)===el&&300>J()-Hn?(sl&2)===0&&qa(l,0):Gc|=e,Ra===el&&(Ra=0)),Xt(l)}function Ro(l,t){t===0&&(t=Mf()),l=Qe(l,t),l!==null&&(ka(l,t),Xt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Ro(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Ro(l,e)}function Sv(l,t){return La(l,t)}var Xn=null,Ya=null,wc=!1,Qn=!1,Wc=!1,je=0;function Xt(l){l!==Ya&&l.next===null&&(Ya===null?Xn=Ya=l:Ya=Ya.next=l),Qn=!0,wc||(wc=!0,zv())}function Du(l,t){if(!Wc&&Qn){Wc=!0;do for(var e=!1,a=Xn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-ot(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Yo(a,n))}else n=el,n=Lu(a,a===gl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||Wa(a,n)||(e=!0,Yo(a,n));a=a.next}while(e);Wc=!1}}function bv(){xo()}function xo(){Qn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=J(),e=null,a=Xn;a!==null;){var u=a.next,n=qo(a,t);n===0?(a.next=null,e===null?Xn=u:e.next=u,u===null&&(Ya=e)):(e=a,(l!==0||(n&3)!==0)&&(Qn=!0)),a=u}Ql!==0&&Ql!==5||Du(l),je!==0&&(je=0)}function qo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,A=f.initiatorType;E&&Jo(A)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function ur(l,t,e){var a=Ga;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ar.has(u)||(ar.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),ur("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),ur("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Ga;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Xa(l);break;case"script":n=Qa(l)}Ht.has(n)||(l=H({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Ru(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Ga;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Qa(l)}if(!Ht.has(n)&&(l=H({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ru(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Ga;if(a&&l){var u=fa(a).hoistableStyles,n=Xa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=H({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&of(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(h,E){f.onload=h,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Jn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=H({src:l,async:!0},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Ru(u)),n||(l=H({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&rf(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function nr(l,t,e,a){var u=(u=L.current)?Kn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Xa(e.href),e=fa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Xa(e.href);var n=fa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qa(e),e=fa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Xa(l){return'href="'+At(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function ir(l){return H({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Qa(l){return'[src="'+At(l)+'"]'}function Ru(l){return"script[async]"+l}function cr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=H({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),Jn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Xa(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=ir(e),(u=Ht.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,Jn(n,e.precedence,l),t.instance=n;case"script":return n=Qa(e.src),(u=l.querySelector(Ru(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=H({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Jn(a,e.precedence,l));return t.instance}function Jn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function dr(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function Wv(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Xa(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=ir(a),(u=Ht.get(u))&&of(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function kv(l,t){return l.stylesheets&&l.count===0&&$n(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$n(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var kn=null;function $n(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,kn=new Map,t.forEach($v,l),kn=null,Wn.call(l))}function $v(l,t){if(!(t.state.loading&4)){var e=kn.get(l);if(e)var a=e.get(null);else{e=new Map,kn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m)}catch(U){console.error(U)}}return m(),pf.exports=yy(),pf.exports}var gy=hy();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(m){const U=m.camera;if(_l.camera==="head")m.controls.target.set(0,10,0),U.position.set(10,12,18);else{m.controls.target.set(0,0,0);const M=48;_l.camera==="front"?U.position.set(0,0,M):_l.camera==="back"?U.position.set(0,0,-M):U.position.set(23,7,42)}U.lookAt(m.controls.target),U.updateProjectionMatrix(),m.controls.update()}function Yr(){_l.syncing=!0;try{_l.viewers.forEach(m=>Sy(m.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(m=>m.classList.toggle("active",m.dataset.camera===_l.camera))}function by(m){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:U}of _l.viewers)U!==m&&(U.camera.position.copy(m.camera.position),U.camera.quaternion.copy(m.camera.quaternion),U.camera.zoom=m.camera.zoom,U.controls.target.copy(m.controls.target),U.camera.updateProjectionMatrix(),U.controls.update())}finally{_l.syncing=!1}}}function zy(m,U,M){const v=m.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:m.querySelector("canvas"),width:m.clientWidth||220,height:m.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>by(D));const V=new ResizeObserver(()=>{!D.disposed&&m.clientWidth&&m.clientHeight&&(D.width=m.clientWidth,D.height=m.clientHeight)});V.observe(m),_l.viewers.push({viewer:D,observer:V}),Promise.resolve(D.loadSkin(U.url,{model:"default"})).then(()=>{M!==_l.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{M===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function Ey(m,U){zy(m,U,_l.generation),Yr();const M=_l.viewers.find(v=>v.viewer.canvas===m.querySelector("canvas"))||_l.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==M))}}function py(m,U,M){const v=_l.camera!==m;Object.assign(_l,{camera:m,outerLayer:U,uvOnly:M}),v&&Yr(),_l.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(U),D.renderPaused=M})}async function ii(m,U,M){const v=await fetch("/api/meat-model/"+m,U===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(U),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Gr=m=>["complete","failed"].includes(m);function Xr(m){const U={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取图像特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别 meat",complete:"已完成",failed:"失败"},M=m?.progress;return(U[m?.stage]||"正在预选")+(M?.fold?` · ${M.variant==="local"?"局部特征":"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[m,U]=Z.useState(null),[M,v]=Z.useState(""),[D,V]=Z.useState(!1),k=Z.useRef(!0),nl=Z.useRef(null),N=Z.useRef(!1),T=async()=>{try{const Y=await ii("status");k.current&&(U(Y),v(""))}catch(Y){k.current&&v(Y.message)}};Z.useEffect(()=>{k.current=!0,T();const Y=()=>T();return window.addEventListener("meat-saved",Y),nl.current=setInterval(T,1e4),()=>{k.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",Y)}},[]);const Q=m?.training&&!Gr(m.training.stage),H=async()=>{if(!N.current){N.current=!0,V(!0),v("");try{const Y=await ii("train",{});k.current&&U(ml=>({...ml,training:Y}))}catch(Y){k.current&&v(Y.message)}finally{N.current=!1,k.current&&(V(!1),T())}}};return g.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Meat 预选模型"}),g.jsx("span",{children:m?.active?` ${m.active.id} · 已学习 ${m.active.count} 张`:" 正在连接 ds…"}),g.jsx("p",{children:"仅在点击按钮时训练;保存标注不会自动更新模型。训练期间仍使用当前模型。"}),m?.dataset&&g.jsxs("p",{children:["当前可训练 ",m.dataset.count," 张 · 新增或修改 ",m.dataset.changed," 张",m.dataset.removed>0?` · 移除或失效 ${m.dataset.removed} 张`:""]})]}),g.jsxs("div",{className:"meat-model-actions",children:[g.jsx("button",{className:"button",onClick:H,disabled:D||Q||!m?.active||m?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),g.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),m?.training&&g.jsxs("p",{role:"status",children:[Xr(m.training),m.training.stage==="complete"?" · 新模型已启用":"",m.training.error?`:${m.training.error}。原模型保持可用。`:""]}),m?.active?.metrics&&g.jsxs("small",{children:["历史皮肤分组验证 IoU ",(m.active.metrics.iou*100).toFixed(1),"%;这不是新皮肤准确率,预选仍需人工检查。"]}),!!m?.dataset?.excluded?.length&&g.jsxs("details",{children:[g.jsxs("summary",{children:[m.dataset.excluded.length," 张未纳入本轮训练"]}),m.dataset.excluded.map((Y,ml)=>g.jsxs("p",{children:[Y.id,":",Y.reason]},ml))]}),M&&g.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function Uy({data:m,disabled:U,onStart:M,onEnd:v,onApply:D}){const[V,k]=Z.useState(!1),[nl,N]=Z.useState(""),[T,Q]=Z.useState(""),H=Z.useRef(!0),Y=Z.useRef(null),ml=Z.useRef(!1);Z.useEffect(()=>(H.current=!0,()=>{H.current=!1,Y.current?.abort()}),[]);const Al=async()=>{if(ml.current)return;ml.current=!0,k(!0),Q(""),N("正在请求预选…"),M(),Y.current=new AbortController;const Nl=Y.current.signal;try{let K=await ii("predict",{key:m.key,skin_revision:m.skin_revision},Nl);for(;!Gr(K.stage);){if(!H.current||(N(Xr(K)),await new Promise(pl=>setTimeout(pl,1500)),!H.current))return;K=await ii("job?id="+encodeURIComponent(K.id),void 0,Nl)}if(K.stage==="failed")throw Error(K.error||"预选失败,请稍后重试");if(K.prediction.skin_revision!==m.skin_revision)throw Error("皮肤版本已变化,未应用预选");H.current&&(D(K.prediction),N(`预选来自 ${K.prediction.model_id} · ${K.prediction.selected.length} 格。请检查并修改,再保存。`))}catch(K){H.current&&K.name!=="AbortError"&&(Q(K.message),N(""))}finally{ml.current=!1,H.current&&(k(!1),v())}};return g.jsxs("div",{className:"meat-preselect",children:[g.jsx("button",{className:"button secondary",onClick:Al,disabled:U||V||m.model!=="classic",children:V?"模型预选中…":"模型预选"}),g.jsx("span",{children:m.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),nl&&g.jsx("p",{role:"status",children:nl}),T&&g.jsx("p",{role:"alert",className:"meat-warning",children:T})]})}const _y=Z.lazy(()=>Br(()=>import("./SkinEditor-DeZxzTfI.js"),__vite__mapDeps([0,1,2])).then(m=>({default:m.SkinEditor}))),Ay=Z.lazy(()=>Br(()=>import("./MeatEditor-C-IGVOEE.js"),__vite__mapDeps([3,1]))),xe=m=>!!(m.best||m.rejection),ui=m=>m.model??m.folder,xr=m=>m==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(m,U)=>U==="all"||U==="perfect"&&!!m.perfect||U==="meat_pending"&&!!m.perfect&&m.meat_status!=="saved"||U==="meat_saved"&&!!m.perfect&&m.meat_status==="saved"||U==="best"&&!!m.best||U==="ordinary"&&!!m.best&&!m.perfect||m.rejection===U,qr=m=>m.version==="original"?"原版":m.version;async function ni(m,U){const M=await fetch(m,U===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(U)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function jy({result:m}){const U=Z.useRef(null);return Z.useEffect(()=>Ey(U.current,m),[m.url]),g.jsxs("div",{className:"skin-stage",ref:U,children:[g.jsx("canvas",{}),g.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[m,U]=Z.useState([]),[M,v]=Z.useState(null),[D,V]=Z.useState("pending"),[k,nl]=Z.useState("all"),[N,T]=Z.useState(""),[Q,H]=Z.useState(""),[Y,ml]=Z.useState(new Set),[Al,Nl]=Z.useState([]),[K,pl]=Z.useState(!1),[Gl,Xl]=Z.useState(null),[Fl,bt]=Z.useState("angle"),[Zl,P]=Z.useState(!0),[Ul,zt]=Z.useState(!1),[et,Kl]=Z.useState(null),[Ml,Et]=Z.useState(null),[Sl,Pl]=Z.useState(null),[p,j]=Z.useState(!1),C=Z.useRef(!1),fl=Z.useRef(null),dl=Z.useRef(null),d=Z.useRef(null),r=m.find(b=>b.key===M),O=(b,q=D,J=N,lt=Q,Ol=k)=>(!J||ui(b)===J)&&b.id.toLowerCase().includes(lt.trim().toLowerCase())&&(q==="all"||q==="pending"&&b.results.length>0&&!xe(b)||q==="done"&&xe(b)&&My(b,Ol)||q==="rejected"&&!!b.rejection||q==="no_results"&&!b.results.length),R=m.filter(b=>O(b)),w=r&&!R.includes(r)?[r,...R]:R,L=(b,q=!1)=>Xl({message:b,error:q}),I=(b,q=!0)=>{C.current||(q&&M&&M!==b&&Nl(J=>[...J,M]),v(b))},Rl=(b=D,q=N,J=Q,lt=Y)=>m.find(Ol=>O(Ol,b,q,J)&&!lt.has(Ol.key))?.key||null,bl=(b=m,q=Y)=>{const J=b.filter(Ol=>O(Ol)&&!q.has(Ol.key)&&Ol.key!==M),lt=b.findIndex(Ol=>Ol.key===M);I((J.find(Ol=>b.indexOf(Ol)>lt)||J[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,pl(!0);try{const q=await ni(b?"/api/refresh":"/api/state",b?{}:void 0);U(q.items),v(q.items.find(J=>J.key===M&&O(J))?.key||q.items.find(J=>O(J)&&!Y.has(J.key))?.key||null),b&&L("目录已刷新")}catch(q){L(q.message,!0)}finally{C.current=!1,pl(!1)}}}async function pt(b,q,J){if(!(C.current||!r)){C.current=!0,pl(!0);try{const lt=await ni("/api/"+b,{key:r.key,revision:r.revision,result:q?.name,reason:typeof q=="string"?q:void 0,png:J}),Ol=m.map(se=>se.key===M?lt.item:se);U(Ol);const Tt=new Set(Y);Tt.delete(M),ml(Tt),C.current=!1,Et(null),b!=="clear"&&bl(Ol,Tt),L(b==="clear"?"已撤销标注":"已保存 · "+r.id)}catch(lt){L(lt.message,!0)}finally{C.current=!1,pl(!1)}}}async function la(b=r){if(!(C.current||!b?.perfect)){C.current=!0,pl(!0);try{const q=await ni("/api/meat?key="+encodeURIComponent(b.key));j(!1),Pl(q)}catch(q){L(q.message,!0)}finally{C.current=!1,pl(!1)}}}const Va=()=>{C.current||p&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(Pl(null),j(!1))};async function Qt(b,q,J){if(!(C.current||!Sl)){C.current=!0,pl(!0);try{const lt=await ni("/api/meat",{key:Sl.key,revision:Sl.revision,skin_revision:Sl.skin_revision,meat_revision:Sl.meat_revision,selected:b,assistance:J});window.dispatchEvent(new Event("meat-saved"));const Ol=m.map(Tt=>Tt.key===Sl.key?lt.item:Tt);if(U(Ol),Pl(null),j(!1),L("meat 已保存 · "+Sl.id+" · "+b.length+" 格"),C.current=!1,q){const Tt=Ol.findIndex(Vt=>Vt.key===Sl.key),Ja=[...Ol.slice(Tt+1),...Ol.slice(0,Tt)].find(Vt=>Vt.perfect&&Vt.meat_status!=="saved"&&(!N||ui(Vt)===N)&&Vt.id.toLowerCase().includes(Q.trim().toLowerCase()));Ja?(I(Ja.key),await la(Ja)):L("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(lt){L(lt.message,!0)}finally{C.current=!1,pl(!1)}}}function ta(){if(C.current||!r)return;const b=new Set(Y);b.add(M),ml(b),bl(m,b)}function ea(){!C.current&&Al.length&&(v(Al.at(-1)),Nl(Al.slice(0,-1)))}Z.useEffect(()=>{fe()},[]),Z.useEffect(()=>py(Fl,Zl,Ul),[Fl,Zl,Ul,M]),Z.useEffect(()=>{if(!Gl)return;const b=setTimeout(()=>Xl(null),Gl.error?8e3:3500);return()=>clearTimeout(b)},[Gl]),Z.useEffect(()=>{et&&fl.current?.showModal()},[et]),Z.useEffect(()=>{Ml&&dl.current?.showModal()},[Ml]),Z.useEffect(()=>{Sl&&d.current?.showModal()},[Sl]),Z.useEffect(()=>{const b=q=>{if(!(K||et||Ml||Sl||q.ctrlKey||q.metaKey||q.altKey||q.target.closest("input,select,textarea,[contenteditable]"))){if(q.key.toLowerCase()==="s")q.preventDefault(),ta();else if(q.key==="ArrowLeft")q.preventDefault(),ea();else if(q.key==="ArrowRight")q.preventDefault(),bl();else if(/^[1-9]$/.test(q.key)){const J=r?.results[+q.key-1];J&&(q.preventDefault(),pt("choose",J))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Zt=m.filter(b=>!N||ui(b)===N),aa=Zt.filter(xe).length,ua=aa+Zt.filter(b=>b.results.length&&!xe(b)).length,La={done:Zt.filter(xe).length,pending:Zt.filter(b=>b.results.length&&!xe(b)).length,rejected:Zt.filter(b=>b.rejection).length,all:Zt.length,no_results:Zt.filter(b=>!b.results.length).length},Ka=b=>{C.current||(V(b),I(Rl(b)))};return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"brand-icon",children:"D"}),g.jsxs("div",{children:[g.jsx("h1",{children:"DDJ 最佳结果标注"}),g.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),g.jsxs("div",{className:"progress",children:[g.jsxs("div",{children:[g.jsx("span",{children:"标注进度"}),g.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),g.jsx("div",{className:"progress-track",children:g.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),g.jsx("button",{id:"refresh",className:"button secondary",disabled:K,onClick:()=>fe(!0),children:"刷新目录"})]}),g.jsxs("section",{className:"filters",children:[g.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,q])=>g.jsxs("button",{"data-filter":b,disabled:K,className:D===b?"active":"",onClick:()=>Ka(b),children:[q," ",g.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:La[b]})]},b))}),g.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:K,value:N,onChange:b=>{T(b.target.value),I(Rl(D,b.target.value))},children:[g.jsx("option",{value:"",children:"所有模型"}),[...new Set(m.map(ui))].map(b=>g.jsx("option",{children:b},b))]}),g.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:K,value:Q,onChange:b=>{H(b.target.value),I(Rl(D,N,b.target.value))}})]}),D==="done"&&g.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[g.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),g.jsx("select",{id:"annotationType",disabled:K,value:k,onChange:b=>{const q=b.target.value;nl(q),I(m.find(J=>O(J,"done",N,Q,q)&&!Y.has(J.key))?.key||null)},children:Object.entries(Oy).map(([b,q])=>g.jsxs("option",{value:b,children:[q," ·"," ",m.filter(J=>O(J,"done",N,Q,b)).length]},b))}),g.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),g.jsx(Ty,{}),g.jsx("main",{children:r?g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"item-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:r.folder}),g.jsx("h2",{id:"itemId",children:r.id}),g.jsxs("p",{id:"itemInfo",children:[r.results.length," 个结果版本 ·"," ",r.annotation_conflict?"标注冲突,请重新选择":r.invalid_best||r.invalid_rejection?"标注已失效,请重新选择":r.perfect?"已选最佳(完美)":r.best?"已保存最佳结果":r.rejection?xr(r.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),g.jsxs("div",{className:"jump",children:[g.jsx("label",{htmlFor:"jump",children:"跳转条目"}),g.jsx("select",{id:"jump",disabled:K,value:M,onChange:b=>{const q=new Set(Y);q.delete(b.target.value),ml(q),I(b.target.value)},children:w.map(b=>g.jsxs("option",{value:b.key,children:[b.perfect?"★ ":xe(b)?"✓ ":"",b.id]},b.key))})]})]}),g.jsxs("div",{className:"workspace",id:"workspace",children:[g.jsxs("aside",{className:"source-panel panel",children:[g.jsx("div",{className:"reference-images",children:[["source","原图",r.source_url],["edited","中间图",r.edited_url]].map(([b,q,J])=>g.jsxs("section",{className:"reference-image",children:[g.jsxs("div",{className:"panel-title",children:[g.jsxs("h3",{children:[b," · ",q]}),g.jsx("span",{children:b==="source"&&r.source_error?"err 样例":""})]}),g.jsx("button",{hidden:!J,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:J,title:r.id+"_"+b}),children:g.jsx("img",{id:b+"Image",src:J||void 0,alt:q})}),b==="edited"&&g.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!J,children:"暂无 edited 图片"})]},b))}),g.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),g.jsxs("div",{className:"reject-actions",children:[g.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:K||!r.results.length||r.rejection==="result_unsatisfied",onClick:()=>pt("reject","result_unsatisfied"),children:"结果都不满意"}),g.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:K||!r.edited_url||r.rejection==="edited_unsatisfied",onClick:()=>pt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),g.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!xe(r)&&!r.invalid_best&&!r.invalid_rejection&&!r.annotation_conflict,children:[g.jsxs("span",{children:["当前标注",r.perfect?" · 完美":""]}),g.jsx("strong",{id:"savedName",children:r.rejection?xr(r.rejection):r.best||"原标注需要重新选择"}),r.perfect_url&&g.jsx("button",{className:"text-button",onClick:()=>Kl({url:r.perfect_url,title:r.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),r.perfect&&g.jsxs("div",{className:"meat-entry",children:[g.jsx("button",{id:"annotateMeat",className:"button",disabled:K,onClick:()=>la(),children:r.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),g.jsx("p",{className:"meat-status",children:r.meat_status==="saved"?`已标注 ${r.meat_count} 格 meat`:r.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),g.jsx("button",{id:"clearBest",className:"text-button",disabled:K,onClick:()=>pt("clear"),children:"撤销此标注"})]}),g.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),g.jsxs("section",{className:"comparison",children:[g.jsxs("div",{className:"comparison-toolbar",children:[g.jsxs("div",{className:"camera-buttons",children:[g.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,q])=>g.jsx("button",{"data-camera":b,className:Fl===b?"active":"",onClick:()=>bt(b),children:q},b))]}),g.jsxs("div",{className:"view-options",children:[g.jsxs("label",{children:[g.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:b=>P(b.target.checked)}),"显示外层"]}),g.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Ul,onClick:()=>zt(!Ul),children:Ul?"显示 3D":"只看 UV"})]})]}),g.jsxs("div",{id:"results",className:"result-grid"+(Ul?" uv-only":""),children:[r.results.map((b,q)=>g.jsxs("article",{"data-result":b.name,className:"result-card"+(r.best===b.name?" selected":""),children:[g.jsxs("div",{className:"result-header",children:[g.jsx("span",{className:"version-name",children:qr(b)}),g.jsx("span",{className:r.best===b.name?"chosen-badge":"version-number",children:r.best===b.name?r.perfect?"最佳 · 完美":"已选最佳":q+1})]}),g.jsx(jy,{result:b}),g.jsxs("div",{className:"uv-area",children:[g.jsx("button",{className:"uv-button",onClick:()=>Kl({url:b.url,title:b.name,pixelated:!0}),children:g.jsx("img",{src:b.url,alt:qr(b)+" 的 UV 贴图"})}),g.jsxs("div",{className:"uv-caption",children:[g.jsx("strong",{children:"UV 贴图"}),g.jsx("span",{children:"点击放大"})]})]}),g.jsxs("div",{className:"result-actions",children:[g.jsx("div",{className:"result-file",children:b.name}),g.jsx("button",{className:"choose-button",disabled:K||r.best===b.name&&!r.perfect,onClick:()=>pt("choose",b),children:r.best===b.name&&!r.perfect?"当前最佳":"选为最佳"}),g.jsx("button",{className:"perfect-button",disabled:K||r.perfect===b.name&&!r.perfect_url,onClick:()=>pt("perfect",b),children:"选为最佳(完美)"}),g.jsx("button",{className:"repair-button",disabled:K,onClick:()=>Et({result:b,url:r.perfect===b.name&&r.perfect_url?r.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},r.key+b.name)),!r.results.length&&g.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),g.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):g.jsxs("section",{id:"empty",className:"empty panel",children:[g.jsx("h2",{children:"当前筛选下没有更多条目"}),g.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),g.jsx("button",{id:"resume",className:"button primary",disabled:K,onClick:()=>{ml(new Set),V("pending"),T(""),H(""),I(Rl("pending","","",new Set))},children:"继续查看待标注"})]})}),g.jsxs("footer",{className:"footer",children:[g.jsxs("div",{className:"navigation",children:[g.jsx("button",{id:"previous",className:"button secondary",disabled:K||!Al.length,onClick:ea,children:"← 上一个"}),g.jsx("button",{id:"skip",className:"button secondary",disabled:K||!r,onClick:ta,children:"暂时忽略 →"})]}),g.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),g.jsxs("span",{children:["本次已忽略 ",Y.size," 项 · 忽略不保存"]})]}),Gl&&g.jsx("div",{id:"toast",role:"status",className:"toast"+(Gl.error?" error":""),children:Gl.message}),et&&g.jsxs("dialog",{id:"imageDialog",ref:fl,onCancel:()=>Kl(null),onClick:b=>{b.target===b.currentTarget&&Kl(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsx("span",{children:et.title}),g.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),g.jsx("div",{className:"dialog-image",children:g.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Ml&&g.jsxs("dialog",{className:"editor-dialog",ref:dl,onCancel:b=>{b.preventDefault(),K||Et(null)},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["修复 ",Ml.result.name," · 左键绘制,右键旋转"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:()=>Et(null),children:"取消 ×"})]}),g.jsxs("div",{className:"editor-content",children:[g.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[g.jsx("h3",{children:"edited · 参考图"}),r?.edited_url?g.jsx("img",{src:r.edited_url,alt:`${r.id} 的 edited 参考图`}):g.jsx("p",{children:"此条目暂无 edited 图片"})]}),g.jsx("div",{className:"editor-canvas-panel",children:g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载皮肤编辑器…"}),children:g.jsx(_y,{textureUrl:Ml.url,busy:K,onError:b=>L(b,!0),onSubmit:b=>pt("repair",Ml.result,b)})})})]}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]}),Sl&&g.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),Va()},children:[g.jsxs("div",{className:"dialog-top",children:[g.jsxs("span",{children:["meat 标注 · ",Sl.id," · ",Sl.model==="slim"?"纤细手臂":"标准手臂"]}),g.jsx("button",{className:"button secondary",disabled:K,onClick:Va,children:"关闭 ×"})]}),g.jsx(Z.Suspense,{fallback:g.jsx("p",{children:"正在加载 meat 标注器…"}),children:g.jsx(Ay,{data:Sl,busy:K,onSave:Qt,onDirty:j},Sl.key)}),Gl?.error&&g.jsx("p",{role:"alert",children:Gl.message})]})]})}gy.createRoot(document.getElementById("root")).render(g.jsx(Dy,{}));export{Uy as M,Ny as R,Of as a,ry as b,cy as g,g as j,Z as r}; diff --git a/best_annotator/static/assets/index-F-L6ur0r.js b/best_annotator/static/assets/index-F-L6ur0r.js new file mode 100644 index 0000000000000000000000000000000000000000..972654852179851dfe9e1b91d38f8a3bf3fdd459 --- /dev/null +++ b/best_annotator/static/assets/index-F-L6ur0r.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-Lxi3fNFj.js","assets/OrbitControls-DCehNZC0.js","assets/SkinEditor-CzI5mIez.css","assets/MeatEditor-CqBAWHN1.js"])))=>i.map(i=>d[i]); +(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const w of D)if(w.type==="childList")for(const al of w.addedNodes)al.tagName==="LINK"&&al.rel==="modulepreload"&&v(al)}).observe(document,{childList:!0,subtree:!0});function R(D){const w={};return D.integrity&&(w.integrity=D.integrity),D.referrerPolicy&&(w.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?w.credentials="include":D.crossOrigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function v(D){if(D.ep)return;D.ep=!0;const w=R(D);fetch(D.href,w)}})();const er="modulepreload",ar=function(S){return"/"+S},_m={},qm=function(C,R,v){let D=Promise.resolve();if(R&&R.length>0){let N=function(A){return Promise.all(A.map(Z=>Promise.resolve(Z).then(B=>({status:"fulfilled",value:B}),B=>({status:"rejected",reason:B}))))};document.getElementsByTagName("link");const al=document.querySelector("meta[property=csp-nonce]"),yl=al?.nonce||al?.getAttribute("nonce");D=N(R.map(A=>{if(A=ar(A),A in _m)return;_m[A]=!0;const Z=A.endsWith(".css"),B=Z?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${B}`))return;const K=document.createElement("link");if(K.rel=Z?"stylesheet":er,Z||(K.as="script"),K.crossOrigin="",K.href=A,yl&&K.setAttribute("nonce",yl),document.head.appendChild(K),Z)return new Promise((Hl,Dl)=>{K.addEventListener("load",Hl),K.addEventListener("error",()=>Dl(new Error(`Unable to preload CSS for ${A}`)))})}))}function w(al){const yl=new Event("vite:preloadError",{cancelable:!0});if(yl.payload=al,window.dispatchEvent(yl),!yl.defaultPrevented)throw al}return D.then(al=>{for(const yl of al||[])yl.status==="rejected"&&w(yl.reason);return C().catch(w)})};function ur(S){return S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S}var Sf={exports:{}},Yu={};var pm;function nr(){if(pm)return Yu;pm=1;var S=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function R(v,D,w){var al=null;if(w!==void 0&&(al=""+w),D.key!==void 0&&(al=""+D.key),"key"in D){w={};for(var yl in D)yl!=="key"&&(w[yl]=D[yl])}else w=D;return D=w.ref,{$$typeof:S,type:v,key:al,ref:D!==void 0?D:null,props:w}}return Yu.Fragment=C,Yu.jsx=R,Yu.jsxs=R,Yu}var Am;function ir(){return Am||(Am=1,Sf.exports=nr()),Sf.exports}var z=ir(),bf={exports:{}},L={};var Om;function cr(){if(Om)return L;Om=1;var S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),al=Symbol.for("react.context"),yl=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),A=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),K=Symbol.iterator;function Hl(d){return d===null||typeof d!="object"?null:(d=K&&d[K]||d["@@iterator"],typeof d=="function"?d:null)}var Dl={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ql=Object.assign,ul={};function pl(d,m,O){this.props=d,this.context=m,this.refs=ul,this.updater=O||Dl}pl.prototype.isReactComponent={},pl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},pl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Yl(){}Yl.prototype=pl.prototype;function Gl(d,m,O){this.props=d,this.context=m,this.refs=ul,this.updater=O||Dl}var Fl=Gl.prototype=new Yl;Fl.constructor=Gl,Ql(Fl,pl.prototype),Fl.isPureReactComponent=!0;var bt=Array.isArray;function Zl(){}var $={H:null,A:null,T:null,S:null},jl=Object.prototype.hasOwnProperty;function zt(d,m,O){var U=O.ref;return{$$typeof:S,type:d,key:m,ref:U!==void 0?U:null,props:O}}function et(d,m){return zt(d.type,m,d.props)}function Kl(d){return typeof d=="object"&&d!==null&&d.$$typeof===S}function Al(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var Et=/\/+/g;function gl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Al(""+d.key):m.toString(36)}function lt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(Zl,Zl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function T(d,m,O,U,V){var Q=typeof d;(Q==="undefined"||Q==="boolean")&&(d=null);var k=!1;if(d===null)k=!0;else switch(Q){case"bigint":case"string":case"number":k=!0;break;case"object":switch(d.$$typeof){case S:case C:k=!0;break;case Z:return k=d._init,T(k(d._payload),m,O,U,V)}}if(k)return V=V(d),k=U===""?"."+gl(d,0):U,bt(V)?(O="",k!=null&&(O=k.replace(Et,"$&/")+"/"),T(V,m,O,"",function(ce){return ce})):V!=null&&(Kl(V)&&(V=et(V,O+(V.key==null||d&&d.key===V.key?"":(""+V.key).replace(Et,"$&/")+"/")+k)),m.push(V)),1;k=0;var Cl=U===""?".":U+":";if(bt(d))for(var Sl=0;Sl>>1,sl=T[cl];if(0>>1;clD(O,j))UD(V,O)?(T[cl]=V,T[U]=j,cl=U):(T[cl]=O,T[m]=j,cl=m);else if(UD(V,j))T[cl]=V,T[U]=j,cl=U;else break l}}return M}function D(T,M){var j=T.sortIndex-M.sortIndex;return j!==0?j:T.id-M.id}if(S.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var w=performance;S.unstable_now=function(){return w.now()}}else{var al=Date,yl=al.now();S.unstable_now=function(){return al.now()-yl}}var N=[],A=[],Z=1,B=null,K=3,Hl=!1,Dl=!1,Ql=!1,ul=!1,pl=typeof setTimeout=="function"?setTimeout:null,Yl=typeof clearTimeout=="function"?clearTimeout:null,Gl=typeof setImmediate<"u"?setImmediate:null;function Fl(T){for(var M=R(A);M!==null;){if(M.callback===null)v(A);else if(M.startTime<=T)v(A),M.sortIndex=M.expirationTime,C(N,M);else break;M=R(A)}}function bt(T){if(Ql=!1,Fl(T),!Dl)if(R(N)!==null)Dl=!0,Zl||(Zl=!0,Al());else{var M=R(A);M!==null&<(bt,M.startTime-T)}}var Zl=!1,$=-1,jl=5,zt=-1;function et(){return ul?!0:!(S.unstable_now()-ztT&&et());){var cl=B.callback;if(typeof cl=="function"){B.callback=null,K=B.priorityLevel;var sl=cl(B.expirationTime<=T);if(T=S.unstable_now(),typeof sl=="function"){B.callback=sl,Fl(T),M=!0;break t}B===R(N)&&v(N),Fl(T)}else v(N);B=R(N)}if(B!==null)M=!0;else{var d=R(A);d!==null&<(bt,d.startTime-T),M=!1}}break l}finally{B=null,K=j,Hl=!1}M=void 0}}finally{M?Al():Zl=!1}}}var Al;if(typeof Gl=="function")Al=function(){Gl(Kl)};else if(typeof MessageChannel<"u"){var Et=new MessageChannel,gl=Et.port2;Et.port1.onmessage=Kl,Al=function(){gl.postMessage(null)}}else Al=function(){pl(Kl,0)};function lt(T,M){$=pl(function(){T(S.unstable_now())},M)}S.unstable_IdlePriority=5,S.unstable_ImmediatePriority=1,S.unstable_LowPriority=4,S.unstable_NormalPriority=3,S.unstable_Profiling=null,S.unstable_UserBlockingPriority=2,S.unstable_cancelCallback=function(T){T.callback=null},S.unstable_forceFrameRate=function(T){0>T||125cl?(T.sortIndex=j,C(A,T),R(N)===null&&T===R(A)&&(Ql?(Yl($),$=-1):Ql=!0,lt(bt,j-cl))):(T.sortIndex=sl,C(N,T),Dl||Hl||(Dl=!0,Zl||(Zl=!0,Al()))),T},S.unstable_shouldYield=et,S.unstable_wrapCallback=function(T){var M=K;return function(){var j=K;K=M;try{return T.apply(this,arguments)}finally{K=j}}}})(Tf)),Tf}var jm;function sr(){return jm||(jm=1,Ef.exports=fr()),Ef.exports}var _f={exports:{}},Pl={};var Nm;function dr(){if(Nm)return Pl;Nm=1;var S=pf();function C(N){var A="https://react.dev/errors/"+N;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S)}catch(C){console.error(C)}}return S(),_f.exports=dr(),_f.exports}var Hm;function mr(){if(Hm)return Gu;Hm=1;var S=sr(),C=pf(),R=or();function v(l){var t="https://react.dev/errors/"+l;if(1sl||(l.current=cl[sl],cl[sl]=null,sl--)}function O(l,t){sl++,cl[sl]=l.current,l.current=t}var U=d(null),V=d(null),Q=d(null),k=d(null);function Cl(l,t){switch(O(Q,t),O(V,l),O(U,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?Jo(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=Jo(t),l=wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(U),O(U,l)}function Sl(){m(U),m(V),m(Q)}function ce(l){l.memoizedState!==null&&O(k,l);var t=U.current,e=wo(t,l.type);t!==e&&(O(V,l),O(U,e))}function Tt(l){V.current===l&&(m(U),m(V)),k.current===l&&(m(k),Ru._currentValue=j)}var la,Va;function Qt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",Va=-1)":-1u||f[a]!==y[u]){var E=` +`+f[a].replace(" at new "," at ");return l.displayName&&E.includes("")&&(E=E.replace("",l.displayName)),E}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Qt(e):""}function Zt(l,t){switch(l.tag){case 26:case 27:case 5:return Qt(l.type);case 16:return Qt("Lazy");case 13:return l.child!==t&&t!==null?Qt("Suspense Fallback"):Qt("Suspense");case 19:return Qt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Qt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Zt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,La=S.unstable_scheduleCallback,Ka=S.unstable_cancelCallback,g=S.unstable_shouldYield,x=S.unstable_requestPaint,X=S.unstable_now,Il=S.unstable_getCurrentPriorityLevel,El=S.unstable_ImmediatePriority,xe=S.unstable_UserBlockingPriority,Ct=S.unstable_NormalPriority,fe=S.unstable_LowPriority,Af=S.unstable_IdlePriority,Ym=S.log,Gm=S.unstable_setDisableYieldValue,Ja=null,dt=null;function se(l){if(typeof Ym=="function"&&Gm(l),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Ja,l)}catch{}}var ot=Math.clz32?Math.clz32:Zm,Xm=Math.log,Qm=Math.LN2;function Zm(l){return l>>>=0,l===0?32:31-(Xm(l)/Qm|0)|0}var Xu=256,Qu=262144,Zu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Vu(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function wa(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Vm(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Of(){var l=Zu;return Zu<<=1,(Zu&62914560)===0&&(Zu=4194304),l}function ni(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function Lm(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,y=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var $m=/[\n"\\]/g;function pt(l){return l.replace($m,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function oi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?mi(l,i,_t(t)):e!=null?mi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Gf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){di(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),di(l)}function mi(l,t,e){t==="number"&&Ju(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function da(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gi=!1;if(Kt)try{var Ia={};Object.defineProperty(Ia,"passive",{get:function(){gi=!0}}),window.addEventListener("test",Ia,Ia),window.removeEventListener("test",Ia,Ia)}catch{gi=!1}var oe=null,Si=null,Wu=null;function Jf(){if(Wu)return Wu;var l,t=Si,e=t.length,a,u="value"in oe?oe.value:oe.textContent,n=u.length;for(l=0;l=tu),If=" ",Pf=!1;function ls(l,t){switch(l){case"keyup":return pv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ts(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ra=!1;function Ov(l,t){switch(l){case"compositionend":return ts(t);case"keypress":return t.which!==32?null:(Pf=!0,If);case"textInput":return l=t.data,l===If&&Pf?null:l;default:return null}}function Mv(l,t){if(ra)return l==="compositionend"||!_i&&ls(l,t)?(l=Jf(),Wu=Si=oe=null,ra=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=ss(e)}}function os(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?os(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function ms(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=Ju(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=Ju(l.document)}return t}function Oi(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var xv=Kt&&"documentMode"in document&&11>=document.documentMode,ya=null,Mi=null,nu=null,Di=!1;function vs(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Di||ya==null||ya!==Ju(a)||(a=ya,"selectionStart"in a&&Oi(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),nu&&uu(nu,a)||(nu=a,a=Zn(Mi,"onSelect"),0>=i,u-=i,Bt=1<<32-ot(t)+u|e<W?(ll=q,q=null):ll=q.sibling;var il=h(o,q,r[W],_);if(il===null){q===null&&(q=ll);break}l&&q&&il.alternate===null&&t(o,q),s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il,q=ll}if(W===r.length)return e(o,q),tl&&wt(o,W),Y;if(q===null){for(;WW?(ll=q,q=null):ll=q.sibling;var Ce=h(o,q,il.value,_);if(Ce===null){q===null&&(q=ll);break}l&&q&&Ce.alternate===null&&t(o,q),s=n(Ce,s,W),nl===null?Y=Ce:nl.sibling=Ce,nl=Ce,q=ll}if(il.done)return e(o,q),tl&&wt(o,W),Y;if(q===null){for(;!il.done;W++,il=r.next())il=p(o,il.value,_),il!==null&&(s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il);return tl&&wt(o,W),Y}for(q=a(q);!il.done;W++,il=r.next())il=b(q,o,W,il.value,_),il!==null&&(l&&il.alternate!==null&&q.delete(il.key===null?W:il.key),s=n(il,s,W),nl===null?Y=il:nl.sibling=il,nl=il);return l&&q.forEach(function(tr){return t(o,tr)}),tl&&wt(o,W),Y}function rl(o,s,r,_){if(typeof r=="object"&&r!==null&&r.type===Ql&&r.key===null&&(r=r.props.children),typeof r=="object"&&r!==null){switch(r.$$typeof){case Hl:l:{for(var Y=r.key;s!==null;){if(s.key===Y){if(Y=r.type,Y===Ql){if(s.tag===7){e(o,s.sibling),_=u(s,r.props.children),_.return=o,o=_;break l}}else if(s.elementType===Y||typeof Y=="object"&&Y!==null&&Y.$$typeof===jl&&we(Y)===s.type){e(o,s.sibling),_=u(s,r.props),ou(_,r),_.return=o,o=_;break l}e(o,s);break}else t(o,s);s=s.sibling}r.type===Ql?(_=Ze(r.props.children,o.mode,_,r.key),_.return=o,o=_):(_=un(r.type,r.key,r.props,null,o.mode,_),ou(_,r),_.return=o,o=_)}return i(o);case Dl:l:{for(Y=r.key;s!==null;){if(s.key===Y)if(s.tag===4&&s.stateNode.containerInfo===r.containerInfo&&s.stateNode.implementation===r.implementation){e(o,s.sibling),_=u(s,r.children||[]),_.return=o,o=_;break l}else{e(o,s);break}else t(o,s);s=s.sibling}_=xi(r,o.mode,_),_.return=o,o=_}return i(o);case jl:return r=we(r),rl(o,s,r,_)}if(lt(r))return H(o,s,r,_);if(Al(r)){if(Y=Al(r),typeof Y!="function")throw Error(v(150));return r=Y.call(r),G(o,s,r,_)}if(typeof r.then=="function")return rl(o,s,mn(r),_);if(r.$$typeof===Gl)return rl(o,s,fn(o,r),_);vn(o,r)}return typeof r=="string"&&r!==""||typeof r=="number"||typeof r=="bigint"?(r=""+r,s!==null&&s.tag===6?(e(o,s.sibling),_=u(s,r),_.return=o,o=_):(e(o,s),_=Ri(r,o.mode,_),_.return=o,o=_),i(o)):e(o,s)}return function(o,s,r,_){try{du=0;var Y=rl(o,s,r,_);return Oa=null,Y}catch(q){if(q===Aa||q===dn)throw q;var nl=vt(29,q,null,o.mode);return nl.lanes=_,nl.return=o,nl}}}var ke=qs(!0),Bs=qs(!1),he=!1;function wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wi(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ge(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Se(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(fl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=an(l),zs(l,null,e),t}return en(l,a,t,e),an(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}function ki(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var $i=!1;function vu(){if($i){var l=pa;if(l!==null)throw l}}function ru(l,t,e,a){$i=!1;var u=l.updateQueue;he=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,y=f.next;f.next=null,i===null?n=y:i.next=y,i=f;var E=l.alternate;E!==null&&(E=E.updateQueue,c=E.lastBaseUpdate,c!==i&&(c===null?E.firstBaseUpdate=y:c.next=y,E.lastBaseUpdate=f))}if(n!==null){var p=u.baseState;i=0,E=y=f=null,c=n;do{var h=c.lane&-536870913,b=h!==c.lane;if(b?(P&h)===h:(a&h)===h){h!==0&&h===_a&&($i=!0),E!==null&&(E=E.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var H=l,G=c;h=t;var rl=e;switch(G.tag){case 1:if(H=G.payload,typeof H=="function"){p=H.call(rl,p,h);break l}p=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=G.payload,h=typeof H=="function"?H.call(rl,p,h):H,h==null)break l;p=B({},p,h);break l;case 2:he=!0}}h=c.callback,h!==null&&(l.flags|=64,b&&(l.flags|=8192),b=u.callbacks,b===null?u.callbacks=[h]:b.push(h))}else b={lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},E===null?(y=E=b,f=p):E=E.next=b,i|=h;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;b=c,c=b.next,b.next=null,u.lastBaseUpdate=b,u.shared.pending=null}}while(!0);E===null&&(f=p),u.baseState=f,u.firstBaseUpdate=y,u.lastBaseUpdate=E,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=p}}function Ys(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Gs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=T.T,c={};T.T=c,yc(l,!1,t,e);try{var f=u(),y=T.S;if(y!==null&&y(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var E=Lv(f,a);gu(l,t,E,St(l))}else gu(l,t,a,St(l))}catch(p){gu(l,t,{then:function(){},status:"rejected",reason:p},St())}finally{M.p=n,i!==null&&c.types!==null&&(i.types=c.types),T.T=i}}function $v(){}function vc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=gd(l).queue;hd(l,u,t,j,e===null?$v:function(){return Sd(l),e(a)})}function gd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:j,baseState:j,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:j},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ft,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Sd(l){var t=gd(l);t.next===null&&(t=l.alternate.memoizedState),gu(l,t.next.queue,{},St())}function rc(){return Wl(Ru)}function bd(){return Ul().memoizedState}function zd(){return Ul().memoizedState}function Fv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=St();l=ge(e);var a=Se(t,l,e);a!==null&&(st(a,t,e),mu(a,t,e)),t={cache:Vi()},l.payload=t;return}t=t.return}}function Iv(l,t,e){var a=St();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},_n(l)?Td(t,e):(e=Hi(l,t,e,a),e!==null&&(st(e,l,a),_d(e,t,a)))}function Ed(l,t,e){var a=St();gu(l,t,e,a)}function gu(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(_n(l))Td(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,mt(c,i))return en(l,t,u,0),hl===null&&tn(),!1}catch{}if(e=Hi(l,t,u,a),e!==null)return st(e,l,a),_d(e,t,a),!0}return!1}function yc(l,t,e,a){if(a={lane:2,revertLane:wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_n(l)){if(t)throw Error(v(479))}else t=Hi(l,e,a,2),t!==null&&st(t,l,2)}function _n(l){var t=l.alternate;return l===J||t!==null&&t===J}function Td(l,t){Da=hn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function _d(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Df(l,e)}}var Su={readContext:Wl,use:bn,useCallback:Ol,useContext:Ol,useEffect:Ol,useImperativeHandle:Ol,useLayoutEffect:Ol,useInsertionEffect:Ol,useMemo:Ol,useReducer:Ol,useRef:Ol,useState:Ol,useDebugValue:Ol,useDeferredValue:Ol,useTransition:Ol,useSyncExternalStore:Ol,useId:Ol,useHostTransitionStatus:Ol,useFormState:Ol,useActionState:Ol,useOptimistic:Ol,useMemoCache:Ol,useCacheRefresh:Ol};Su.useEffectEvent=Ol;var pd={readContext:Wl,use:bn,useCallback:function(l,t){return tt().memoizedState=[l,t===void 0?null:t],l},useContext:Wl,useEffect:cd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,En(4194308,4,od.bind(null,t,l),e)},useLayoutEffect:function(l,t){return En(4194308,4,l,t)},useInsertionEffect:function(l,t){En(4,2,l,t)},useMemo:function(l,t){var e=tt();t=t===void 0?null:t;var a=l();if($e){se(!0);try{l()}finally{se(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=tt();if(e!==void 0){var u=e(t);if($e){se(!0);try{e(t)}finally{se(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=Iv.bind(null,J,l),[a.memoizedState,l]},useRef:function(l){var t=tt();return l={current:l},t.memoizedState=l},useState:function(l){l=fc(l);var t=l.queue,e=Ed.bind(null,J,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:oc,useDeferredValue:function(l,t){var e=tt();return mc(e,l,t)},useTransition:function(){var l=fc(!1);return l=hd.bind(null,J,l.queue,!0,!1),tt().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=J,u=tt();if(tl){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),hl===null)throw Error(v(349));(P&127)!==0||Ks(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,cd(ws.bind(null,a,n,l),[l]),a.flags|=2048,Na(9,{destroy:void 0},Js.bind(null,a,n,e,t),null),e},useId:function(){var l=tt(),t=hl.identifierPrefix;if(tl){var e=Yt,a=Bt;e=(a&~(1<<32-ot(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=gn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[Jl]=t,n[at]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch($l(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&Pt(t)}}return zl(t),jc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&Pt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=Q.current,Ea(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[Jl]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Lo(l.nodeValue,e)),l||re(t,!0)}else l=Vn(l).createTextNode(a),l[Jl]=t,t.stateNode=l}return zl(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=Ea(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zl(t),l=!1}else e=Gi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(v(558))}return zl(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=Ea(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[Jl]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zl(t),u=!1}else u=Gi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Dn(t,t.updateQueue),zl(t),null);case 4:return Sl(),l===null&&Fc(t.stateNode.containerInfo),zl(t),null;case 10:return kt(t.type),zl(t),null;case 19:if(m(Nl),a=t.memoizedState,a===null)return zl(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Ml!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=yn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Dn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Es(e,l),e=e.sibling;return O(Nl,Nl.current&1|2),tl&&wt(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&X()>Cn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=yn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Dn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!tl)return zl(t),null}else 2*X()-a.renderingStartTime>Cn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=X(),l.sibling=null,e=Nl.current,O(Nl,u?e&1|2:e&1),tl&&wt(t,a.treeForkCount),l):(zl(t),null);case 22:case 23:return yt(t),Ii(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(zl(t),t.subtreeFlags&6&&(t.flags|=8192)):zl(t),e=t.updateQueue,e!==null&&Dn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Rl),zl(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function a0(l,t){switch(Bi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Rl),Sl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(yt(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Nl),null;case 4:return Sl(),null;case 10:return kt(t.type),null;case 22:case 23:return yt(t),Ii(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Rl),null;case 25:return null;default:return null}}function Wd(l,t){switch(Bi(t),t.tag){case 3:kt(Rl),Sl();break;case 26:case 27:case 5:Tt(t);break;case 4:Sl();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:m(Nl);break;case 10:kt(t.type);break;case 22:case 23:yt(t),Ii(),l!==null&&m(Je);break;case 24:kt(Rl)}}function Eu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){ol(t,t.return,c)}}function Ee(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,y=c;try{y()}catch(E){ol(u,f,E)}}}a=a.next}while(a!==n)}}catch(E){ol(t,t.return,E)}}function kd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Gs(t,e)}catch(a){ol(l,l.return,a)}}}function $d(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){ol(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){ol(l,t,u)}}function Gt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){ol(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){ol(l,t,u)}else e.current=null}function Fd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){ol(l,l.return,u)}}function Nc(l,t,e){try{var a=l.stateNode;A0(a,l.type,e,t),a[at]=t}catch(u){ol(l,l.return,u)}}function Id(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function Uc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||Id(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Lt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Hc(l,t,e),l=l.sibling;l!==null;)Hc(l,t,e),l=l.sibling}function jn(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(jn(l,t,e),l=l.sibling;l!==null;)jn(l,t,e),l=l.sibling}function Pd(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);$l(t,a,e),t[Jl]=l,t[at]=e}catch(n){ol(l,l.return,n)}}var le=!1,Bl=!1,Cc=!1,lo=typeof WeakSet=="function"?WeakSet:Set,Ll=null;function u0(l,t){if(l=l.containerInfo,lf=$n,l=ms(l),Oi(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,y=0,E=0,p=l,h=null;t:for(;;){for(var b;p!==e||u!==0&&p.nodeType!==3||(c=i+u),p!==n||a!==0&&p.nodeType!==3||(f=i+a),p.nodeType===3&&(i+=p.nodeValue.length),(b=p.firstChild)!==null;)h=p,p=b;for(;;){if(p===l)break t;if(h===e&&++y===u&&(c=i),h===n&&++E===a&&(f=i),(b=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=b}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(tf={focusedElem:l,selectionRange:e},$n=!1,Ll=t;Ll!==null;)if(t=Ll,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Ll=l;else for(;Ll!==null;){switch(t=Ll,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),$l(n,a,e),n[Jl]=l,Vl(n),a=n;break l;case"link":var i=cm("link","href",u).get(a+(e.href||""));if(i){for(var c=0;crl&&(i=rl,rl=G,G=i);var o=ds(c,G),s=ds(c,rl);if(o&&s&&(b.rangeCount!==1||b.anchorNode!==o.node||b.anchorOffset!==o.offset||b.focusNode!==s.node||b.focusOffset!==s.offset)){var r=p.createRange();r.setStart(o.node,o.offset),b.removeAllRanges(),G>rl?(b.addRange(r),b.extend(s.node,s.offset)):(r.setEnd(s.node,s.offset),b.addRange(r))}}}}for(p=[],b=c;b=b.parentNode;)b.nodeType===1&&p.push({element:b,left:b.scrollLeft,top:b.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,T.T=null,e=Xc,Xc=null;var n=Ae,i=ne;if(Xl=0,xa=Ae=null,ne=0,(fl&6)!==0)throw Error(v(331));var c=fl;if(fl|=4,mo(n.current),fo(n,n.current,i,e),fl=c,Du(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Ja,n)}catch{}return!0}finally{M.p=u,T.T=a,No(l,t)}}function Ho(l,t,e){t=Ot(e,t),t=bc(l.stateNode,t,2),l=Se(l,t,2),l!==null&&(Wa(l,2),Xt(l))}function ol(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(pe===null||!pe.has(a))){l=Ot(e,l),e=Hd(2),a=Se(t,e,2),a!==null&&(Cd(e,a,t,l),Wa(a,2),Xt(a));break}}t=t.return}}function Lc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new c0;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(qc=!0,u.add(e),l=m0.bind(null,l,t,e),t.then(l,l))}function m0(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,hl===l&&(P&e)===e&&(Ml===4||Ml===3&&(P&62914560)===P&&300>X()-Hn?(fl&2)===0&&qa(l,0):Bc|=e,Ra===P&&(Ra=0)),Xt(l)}function Co(l,t){t===0&&(t=Of()),l=Qe(l,t),l!==null&&(Wa(l,t),Xt(l))}function v0(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Co(l,e)}function r0(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Co(l,e)}function y0(l,t){return La(l,t)}var Gn=null,Ya=null,Kc=!1,Xn=!1,Jc=!1,Me=0;function Xt(l){l!==Ya&&l.next===null&&(Ya===null?Gn=Ya=l:Ya=Ya.next=l),Xn=!0,Kc||(Kc=!0,g0())}function Du(l,t){if(!Jc&&Xn){Jc=!0;do for(var e=!1,a=Gn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-ot(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Bo(a,n))}else n=P,n=Vu(a,a===hl?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||wa(a,n)||(e=!0,Bo(a,n));a=a.next}while(e);Jc=!1}}function h0(){Ro()}function Ro(){Xn=Kc=!1;var l=0;Me!==0&&M0()&&(l=Me);for(var t=X(),e=null,a=Gn;a!==null;){var u=a.next,n=xo(a,t);n===0?(a.next=null,e===null?Gn=u:e.next=u,u===null&&(Ya=e)):(e=a,(l!==0||(n&3)!==0)&&(Xn=!0)),a=u}Xl!==0&&Xl!==5||Du(l),Me!==0&&(Me=0)}function xo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var E=f.transferSize,p=f.initiatorType;E&&Ko(p)&&(f=f.responseEnd,i+=E*(f"u"?null:document;function am(l,t,e){var a=Ga;if(a&&typeof t=="string"&&t){var u=pt(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),em.has(u)||(em.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function q0(l){ie.D(l),am("dns-prefetch",l,null)}function B0(l,t){ie.C(l,t),am("preconnect",l,t)}function Y0(l,t,e){ie.L(l,t,e);var a=Ga;if(a&&l&&t){var u='link[rel="preload"][as="'+pt(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+pt(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+pt(e.imageSizes)+'"]')):u+='[href="'+pt(l)+'"]';var n=u;switch(t){case"style":n=Xa(l);break;case"script":n=Qa(l)}Ht.has(n)||(l=B({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),Ht.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(Hu(n))||t==="script"&&a.querySelector(Cu(n))||(t=a.createElement("link"),$l(t,"link",l),Vl(t),a.head.appendChild(t)))}}function G0(l,t){ie.m(l,t);var e=Ga;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+pt(a)+'"][href="'+pt(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Qa(l)}if(!Ht.has(n)&&(l=B({rel:"modulepreload",href:l},t),Ht.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Cu(n)))return}a=e.createElement("link"),$l(a,"link",l),Vl(a),e.head.appendChild(a)}}}function X0(l,t,e){ie.S(l,t,e);var a=Ga;if(a&&l){var u=fa(a).hoistableStyles,n=Xa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(Hu(n)))c.loading=5;else{l=B({rel:"stylesheet",href:l,"data-precedence":t},e),(e=Ht.get(n))&&sf(l,e);var f=i=a.createElement("link");Vl(f),$l(f,"link",l),f._p=new Promise(function(y,E){f.onload=y,f.onerror=E}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Kn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Q0(l,t){ie.X(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Cu(u)),n||(l=B({src:l,async:!0},t),(t=Ht.get(u))&&df(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Z0(l,t){ie.M(l,t);var e=Ga;if(e&&l){var a=fa(e).hoistableScripts,u=Qa(l),n=a.get(u);n||(n=e.querySelector(Cu(u)),n||(l=B({src:l,async:!0,type:"module"},t),(t=Ht.get(u))&&df(l,t),n=e.createElement("script"),Vl(n),$l(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function um(l,t,e,a){var u=(u=Q.current)?Ln(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Xa(e.href),e=fa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Xa(e.href);var n=fa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(Hu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),Ht.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Ht.set(l,e),n||V0(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qa(e),e=fa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Xa(l){return'href="'+pt(l)+'"'}function Hu(l){return'link[rel="stylesheet"]['+l+"]"}function nm(l){return B({},l,{"data-precedence":l.precedence,precedence:null})}function V0(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),$l(t,"link",e),Vl(t),l.head.appendChild(t))}function Qa(l){return'[src="'+pt(l)+'"]'}function Cu(l){return"script[async]"+l}function im(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+pt(e.href)+'"]');if(a)return t.instance=a,Vl(a),a;var u=B({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Vl(a),$l(a,"style",u),Kn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Xa(e.href);var n=l.querySelector(Hu(u));if(n)return t.state.loading|=4,t.instance=n,Vl(n),n;a=nm(e),(u=Ht.get(u))&&sf(a,u),n=(l.ownerDocument||l).createElement("link"),Vl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),t.state.loading|=4,Kn(n,e.precedence,l),t.instance=n;case"script":return n=Qa(e.src),(u=l.querySelector(Cu(n)))?(t.instance=u,Vl(u),u):(a=e,(u=Ht.get(n))&&(a=B({},e),df(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Vl(u),$l(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Kn(a,e.precedence,l));return t.instance}function Kn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function L0(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function sm(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function K0(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Xa(a.href),n=t.querySelector(Hu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Vl(n);return}n=t.ownerDocument||t,a=nm(a),(u=Ht.get(u))&&sf(a,u),n=n.createElement("link"),Vl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),$l(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var of=0;function J0(l,t){return l.stylesheets&&l.count===0&&kn(l,l.stylesheets),0of?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Wn=null;function kn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Wn=new Map,t.forEach(w0,l),Wn=null,wn.call(l))}function w0(l,t){if(!(t.state.loading&4)){var e=Wn.get(l);if(e)var a=e.get(null);else{e=new Map,Wn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S)}catch(C){console.error(C)}}return S(),zf.exports=mr(),zf.exports}var rr=vr();const _l={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function yr(S){const C=S.camera;if(_l.camera==="head")S.controls.target.set(0,10,0),C.position.set(10,12,18);else{S.controls.target.set(0,0,0);const R=48;_l.camera==="front"?C.position.set(0,0,R):_l.camera==="back"?C.position.set(0,0,-R):C.position.set(23,7,42)}C.lookAt(S.controls.target),C.updateProjectionMatrix(),S.controls.update()}function Bm(){_l.syncing=!0;try{_l.viewers.forEach(S=>yr(S.viewer))}finally{_l.syncing=!1}document.querySelectorAll("[data-camera]").forEach(S=>S.classList.toggle("active",S.dataset.camera===_l.camera))}function hr(S){if(!_l.syncing){_l.syncing=!0;try{for(const{viewer:C}of _l.viewers)C!==S&&(C.camera.position.copy(S.camera.position),C.camera.quaternion.copy(S.camera.quaternion),C.camera.zoom=S.camera.zoom,C.controls.target.copy(S.controls.target),C.camera.updateProjectionMatrix(),C.controls.update())}finally{_l.syncing=!1}}}function gr(S,C,R){const v=S.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:S.querySelector("canvas"),width:S.clientWidth||220,height:S.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:_l.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>hr(D));const w=new ResizeObserver(()=>{!D.disposed&&S.clientWidth&&S.clientHeight&&(D.width=S.clientWidth,D.height=S.clientHeight)});w.observe(S),_l.viewers.push({viewer:D,observer:w}),Promise.resolve(D.loadSkin(C.url,{model:"default"})).then(()=>{R!==_l.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(_l.outerLayer),v.hidden=!0)}).catch(()=>{R===_l.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function Sr(S,C){gr(S,C,_l.generation),Bm();const R=_l.viewers.find(v=>v.viewer.canvas===S.querySelector("canvas"))||_l.viewers.at(-1);return()=>{R&&(R.observer.disconnect(),R.viewer.dispose(),R.viewer.renderer.forceContextLoss(),_l.viewers=_l.viewers.filter(v=>v!==R))}}function br(S,C,R){const v=_l.camera!==S;Object.assign(_l,{camera:S,outerLayer:C,uvOnly:R}),v&&Bm(),_l.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(C),D.renderPaused=R})}const zr=el.lazy(()=>qm(()=>import("./SkinEditor-Lxi3fNFj.js"),__vite__mapDeps([0,1,2])).then(S=>({default:S.SkinEditor}))),Er=el.lazy(()=>qm(()=>import("./MeatEditor-CqBAWHN1.js"),__vite__mapDeps([3,1]))),Re=S=>!!(S.best||S.rejection),ai=S=>S.model??S.folder,Rm=S=>S==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Tr={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},_r=(S,C)=>C==="all"||C==="perfect"&&!!S.perfect||C==="meat_pending"&&!!S.perfect&&S.meat_status!=="saved"||C==="meat_saved"&&!!S.perfect&&S.meat_status==="saved"||C==="best"&&!!S.best||C==="ordinary"&&!!S.best&&!S.perfect||S.rejection===C,xm=S=>S.version==="original"?"原版":S.version;async function ui(S,C){const R=await fetch(S,C===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(C)}),v=await R.json();if(!R.ok)throw Error(v.error||"请求失败");return v}function pr({result:S}){const C=el.useRef(null);return el.useEffect(()=>Sr(C.current,S),[S.url]),z.jsxs("div",{className:"skin-stage",ref:C,children:[z.jsx("canvas",{}),z.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Ar(){const[S,C]=el.useState([]),[R,v]=el.useState(null),[D,w]=el.useState("pending"),[al,yl]=el.useState("all"),[N,A]=el.useState(""),[Z,B]=el.useState(""),[K,Hl]=el.useState(new Set),[Dl,Ql]=el.useState([]),[ul,pl]=el.useState(!1),[Yl,Gl]=el.useState(null),[Fl,bt]=el.useState("angle"),[Zl,$]=el.useState(!0),[jl,zt]=el.useState(!1),[et,Kl]=el.useState(null),[Al,Et]=el.useState(null),[gl,lt]=el.useState(null),[T,M]=el.useState(!1),j=el.useRef(!1),cl=el.useRef(null),sl=el.useRef(null),d=el.useRef(null),m=S.find(g=>g.key===R),O=(g,x=D,X=N,Il=Z,El=al)=>(!X||ai(g)===X)&&g.id.toLowerCase().includes(Il.trim().toLowerCase())&&(x==="all"||x==="pending"&&g.results.length>0&&!Re(g)||x==="done"&&Re(g)&&_r(g,El)||x==="rejected"&&!!g.rejection||x==="no_results"&&!g.results.length),U=S.filter(g=>O(g)),V=m&&!U.includes(m)?[m,...U]:U,Q=(g,x=!1)=>Gl({message:g,error:x}),k=(g,x=!0)=>{j.current||(x&&R&&R!==g&&Ql(X=>[...X,R]),v(g))},Cl=(g=D,x=N,X=Z,Il=K)=>S.find(El=>O(El,g,x,X)&&!Il.has(El.key))?.key||null,Sl=(g=S,x=K)=>{const X=g.filter(El=>O(El)&&!x.has(El.key)&&El.key!==R),Il=g.findIndex(El=>El.key===R);k((X.find(El=>g.indexOf(El)>Il)||X[0])?.key||null)};async function ce(g=!1){if(!j.current){j.current=!0,pl(!0);try{const x=await ui(g?"/api/refresh":"/api/state",g?{}:void 0);C(x.items),v(x.items.find(X=>X.key===R&&O(X))?.key||x.items.find(X=>O(X)&&!K.has(X.key))?.key||null),g&&Q("目录已刷新")}catch(x){Q(x.message,!0)}finally{j.current=!1,pl(!1)}}}async function Tt(g,x,X){if(!(j.current||!m)){j.current=!0,pl(!0);try{const Il=await ui("/api/"+g,{key:m.key,revision:m.revision,result:x?.name,reason:typeof x=="string"?x:void 0,png:X}),El=S.map(Ct=>Ct.key===R?Il.item:Ct);C(El);const xe=new Set(K);xe.delete(R),Hl(xe),j.current=!1,Et(null),g!=="clear"&&Sl(El,xe),Q(g==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(Il){Q(Il.message,!0)}finally{j.current=!1,pl(!1)}}}async function la(g=m){if(!(j.current||!g?.perfect)){j.current=!0,pl(!0);try{const x=await ui("/api/meat?key="+encodeURIComponent(g.key));M(!1),lt(x)}catch(x){Q(x.message,!0)}finally{j.current=!1,pl(!1)}}}const Va=()=>{j.current||T&&!window.confirm("meat 标注尚未保存,放弃本次修改?")||(lt(null),M(!1))};async function Qt(g,x){if(!(j.current||!gl)){j.current=!0,pl(!0);try{const X=await ui("/api/meat",{key:gl.key,revision:gl.revision,skin_revision:gl.skin_revision,meat_revision:gl.meat_revision,selected:g}),Il=S.map(El=>El.key===gl.key?X.item:El);if(C(Il),lt(null),M(!1),Q("meat 已保存 · "+gl.id+" · "+g.length+" 格"),j.current=!1,x){const El=Il.findIndex(fe=>fe.key===gl.key),Ct=[...Il.slice(El+1),...Il.slice(0,El)].find(fe=>fe.perfect&&fe.meat_status!=="saved"&&(!N||ai(fe)===N)&&fe.id.toLowerCase().includes(Z.trim().toLowerCase()));Ct?(k(Ct.key),await la(Ct)):Q("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(X){Q(X.message,!0)}finally{j.current=!1,pl(!1)}}}function ta(){if(j.current||!m)return;const g=new Set(K);g.add(R),Hl(g),Sl(S,g)}function ea(){!j.current&&Dl.length&&(v(Dl.at(-1)),Ql(Dl.slice(0,-1)))}el.useEffect(()=>{ce()},[]),el.useEffect(()=>br(Fl,Zl,jl),[Fl,Zl,jl,R]),el.useEffect(()=>{if(!Yl)return;const g=setTimeout(()=>Gl(null),Yl.error?8e3:3500);return()=>clearTimeout(g)},[Yl]),el.useEffect(()=>{et&&cl.current?.showModal()},[et]),el.useEffect(()=>{Al&&sl.current?.showModal()},[Al]),el.useEffect(()=>{gl&&d.current?.showModal()},[gl]),el.useEffect(()=>{const g=x=>{if(!(ul||et||Al||gl||x.ctrlKey||x.metaKey||x.altKey||x.target.closest("input,select,textarea,[contenteditable]"))){if(x.key.toLowerCase()==="s")x.preventDefault(),ta();else if(x.key==="ArrowLeft")x.preventDefault(),ea();else if(x.key==="ArrowRight")x.preventDefault(),Sl();else if(/^[1-9]$/.test(x.key)){const X=m?.results[+x.key-1];X&&(x.preventDefault(),Tt("choose",X))}}};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)});const Zt=S.filter(g=>!N||ai(g)===N),aa=Zt.filter(Re).length,ua=aa+Zt.filter(g=>g.results.length&&!Re(g)).length,La={done:Zt.filter(Re).length,pending:Zt.filter(g=>g.results.length&&!Re(g)).length,rejected:Zt.filter(g=>g.rejection).length,all:Zt.length,no_results:Zt.filter(g=>!g.results.length).length},Ka=g=>{j.current||(w(g),k(Cl(g)))};return z.jsxs(z.Fragment,{children:[z.jsxs("header",{className:"topbar",children:[z.jsxs("div",{className:"brand",children:[z.jsx("span",{className:"brand-icon",children:"D"}),z.jsxs("div",{children:[z.jsx("h1",{children:"DDJ 最佳结果标注"}),z.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),z.jsxs("div",{className:"progress",children:[z.jsxs("div",{children:[z.jsx("span",{children:"标注进度"}),z.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),z.jsx("div",{className:"progress-track",children:z.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),z.jsx("button",{id:"refresh",className:"button secondary",disabled:ul,onClick:()=>ce(!0),children:"刷新目录"})]}),z.jsxs("section",{className:"filters",children:[z.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([g,x])=>z.jsxs("button",{"data-filter":g,disabled:ul,className:D===g?"active":"",onClick:()=>Ka(g),children:[x," ",z.jsx("b",{id:`${{all:"total",no_results:"noResult"}[g]||g}Count`,children:La[g]})]},g))}),z.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:ul,value:N,onChange:g=>{A(g.target.value),k(Cl(D,g.target.value))},children:[z.jsx("option",{value:"",children:"所有模型"}),[...new Set(S.map(ai))].map(g=>z.jsx("option",{children:g},g))]}),z.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:ul,value:Z,onChange:g=>{B(g.target.value),k(Cl(D,N,g.target.value))}})]}),D==="done"&&z.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[z.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),z.jsx("select",{id:"annotationType",disabled:ul,value:al,onChange:g=>{const x=g.target.value;yl(x),k(S.find(X=>O(X,"done",N,Z,x)&&!K.has(X.key))?.key||null)},children:Object.entries(Tr).map(([g,x])=>z.jsxs("option",{value:g,children:[x," ·"," ",S.filter(X=>O(X,"done",N,Z,g)).length]},g))}),z.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),z.jsx("main",{children:m?z.jsxs(z.Fragment,{children:[z.jsxs("section",{className:"item-heading",children:[z.jsxs("div",{children:[z.jsx("span",{className:"eyebrow",children:m.folder}),z.jsx("h2",{id:"itemId",children:m.id}),z.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?Rm(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),z.jsxs("div",{className:"jump",children:[z.jsx("label",{htmlFor:"jump",children:"跳转条目"}),z.jsx("select",{id:"jump",disabled:ul,value:R,onChange:g=>{const x=new Set(K);x.delete(g.target.value),Hl(x),k(g.target.value)},children:V.map(g=>z.jsxs("option",{value:g.key,children:[g.perfect?"★ ":Re(g)?"✓ ":"",g.id]},g.key))})]})]}),z.jsxs("div",{className:"workspace",id:"workspace",children:[z.jsxs("aside",{className:"source-panel panel",children:[z.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([g,x,X])=>z.jsxs("section",{className:"reference-image",children:[z.jsxs("div",{className:"panel-title",children:[z.jsxs("h3",{children:[g," · ",x]}),z.jsx("span",{children:g==="source"&&m.source_error?"err 样例":""})]}),z.jsx("button",{hidden:!X,id:g==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>Kl({url:X,title:m.id+"_"+g}),children:z.jsx("img",{id:g+"Image",src:X||void 0,alt:x})}),g==="edited"&&z.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!X,children:"暂无 edited 图片"})]},g))}),z.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),z.jsxs("div",{className:"reject-actions",children:[z.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:ul||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),z.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:ul||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),z.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[z.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),z.jsx("strong",{id:"savedName",children:m.rejection?Rm(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&z.jsx("button",{className:"text-button",onClick:()=>Kl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&z.jsxs("div",{className:"meat-entry",children:[z.jsx("button",{id:"annotateMeat",className:"button",disabled:ul,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑 meat":"标注 meat"}),z.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),z.jsx("button",{id:"clearBest",className:"text-button",disabled:ul,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),z.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),z.jsxs("section",{className:"comparison",children:[z.jsxs("div",{className:"comparison-toolbar",children:[z.jsxs("div",{className:"camera-buttons",children:[z.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([g,x])=>z.jsx("button",{"data-camera":g,className:Fl===g?"active":"",onClick:()=>bt(g),children:x},g))]}),z.jsxs("div",{className:"view-options",children:[z.jsxs("label",{children:[z.jsx("input",{id:"outerLayer",type:"checkbox",checked:Zl,onChange:g=>$(g.target.checked)}),"显示外层"]}),z.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":jl,onClick:()=>zt(!jl),children:jl?"显示 3D":"只看 UV"})]})]}),z.jsxs("div",{id:"results",className:"result-grid"+(jl?" uv-only":""),children:[m.results.map((g,x)=>z.jsxs("article",{"data-result":g.name,className:"result-card"+(m.best===g.name?" selected":""),children:[z.jsxs("div",{className:"result-header",children:[z.jsx("span",{className:"version-name",children:xm(g)}),z.jsx("span",{className:m.best===g.name?"chosen-badge":"version-number",children:m.best===g.name?m.perfect?"最佳 · 完美":"已选最佳":x+1})]}),z.jsx(pr,{result:g}),z.jsxs("div",{className:"uv-area",children:[z.jsx("button",{className:"uv-button",onClick:()=>Kl({url:g.url,title:g.name,pixelated:!0}),children:z.jsx("img",{src:g.url,alt:xm(g)+" 的 UV 贴图"})}),z.jsxs("div",{className:"uv-caption",children:[z.jsx("strong",{children:"UV 贴图"}),z.jsx("span",{children:"点击放大"})]})]}),z.jsxs("div",{className:"result-actions",children:[z.jsx("div",{className:"result-file",children:g.name}),z.jsx("button",{className:"choose-button",disabled:ul||m.best===g.name&&!m.perfect,onClick:()=>Tt("choose",g),children:m.best===g.name&&!m.perfect?"当前最佳":"选为最佳"}),z.jsx("button",{className:"perfect-button",disabled:ul||m.perfect===g.name&&!m.perfect_url,onClick:()=>Tt("perfect",g),children:"选为最佳(完美)"}),z.jsx("button",{className:"repair-button",disabled:ul,onClick:()=>Et({result:g,url:m.perfect===g.name&&m.perfect_url?m.perfect_url:g.url}),children:"修复并选为最佳(完美)"})]})]},m.key+g.name)),!m.results.length&&z.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),z.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):z.jsxs("section",{id:"empty",className:"empty panel",children:[z.jsx("h2",{children:"当前筛选下没有更多条目"}),z.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),z.jsx("button",{id:"resume",className:"button primary",disabled:ul,onClick:()=>{Hl(new Set),w("pending"),A(""),B(""),k(Cl("pending","","",new Set))},children:"继续查看待标注"})]})}),z.jsxs("footer",{className:"footer",children:[z.jsxs("div",{className:"navigation",children:[z.jsx("button",{id:"previous",className:"button secondary",disabled:ul||!Dl.length,onClick:ea,children:"← 上一个"}),z.jsx("button",{id:"skip",className:"button secondary",disabled:ul||!m,onClick:ta,children:"暂时忽略 →"})]}),z.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),z.jsxs("span",{children:["本次已忽略 ",K.size," 项 · 忽略不保存"]})]}),Yl&&z.jsx("div",{id:"toast",role:"status",className:"toast"+(Yl.error?" error":""),children:Yl.message}),et&&z.jsxs("dialog",{id:"imageDialog",ref:cl,onCancel:()=>Kl(null),onClick:g=>{g.target===g.currentTarget&&Kl(null)},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsx("span",{children:et.title}),z.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>Kl(null),children:"关闭 ×"})]}),z.jsx("div",{className:"dialog-image",children:z.jsx("img",{id:"dialogImage",src:et.url,alt:"放大预览",className:et.pixelated?"pixelated":""})})]}),Al&&z.jsxs("dialog",{className:"editor-dialog",ref:sl,onCancel:g=>{g.preventDefault(),ul||Et(null)},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsxs("span",{children:["修复 ",Al.result.name," · 左键绘制,右键旋转"]}),z.jsx("button",{className:"button secondary",disabled:ul,onClick:()=>Et(null),children:"取消 ×"})]}),z.jsxs("div",{className:"editor-content",children:[z.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[z.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?z.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):z.jsx("p",{children:"此条目暂无 edited 图片"})]}),z.jsx("div",{className:"editor-canvas-panel",children:z.jsx(el.Suspense,{fallback:z.jsx("p",{children:"正在加载皮肤编辑器…"}),children:z.jsx(zr,{textureUrl:Al.url,busy:ul,onError:g=>Q(g,!0),onSubmit:g=>Tt("repair",Al.result,g)})})})]}),Yl?.error&&z.jsx("p",{role:"alert",children:Yl.message})]}),gl&&z.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:g=>{g.preventDefault(),Va()},children:[z.jsxs("div",{className:"dialog-top",children:[z.jsxs("span",{children:["meat 标注 · ",gl.id," · ",gl.model==="slim"?"纤细手臂":"标准手臂"]}),z.jsx("button",{className:"button secondary",disabled:ul,onClick:Va,children:"关闭 ×"})]}),z.jsx(el.Suspense,{fallback:z.jsx("p",{children:"正在加载 meat 标注器…"}),children:z.jsx(Er,{data:gl,busy:ul,onSave:Qt,onDirty:M},gl.key)}),Yl?.error&&z.jsx("p",{role:"alert",children:Yl.message})]})]})}rr.createRoot(document.getElementById("root")).render(z.jsx(Ar,{}));export{Or as R,pf as a,sr as b,ur as g,z as j,el as r}; diff --git a/best_annotator/static/assets/index-FHNXxhzy.js b/best_annotator/static/assets/index-FHNXxhzy.js new file mode 100644 index 0000000000000000000000000000000000000000..da71602e4f6015223a79a2b0718b12bfc54898c9 --- /dev/null +++ b/best_annotator/static/assets/index-FHNXxhzy.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-D4aKozkb.js","assets/OrbitControls-B8kTSyNG.js","assets/SkinEditor-Do5ASu40.css","assets/MeatEditor-0DhnHy7F.js"])))=>i.map(i=>d[i]); +(function(){const N=document.createElement("link").relList;if(N&&N.supports&&N.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const L of D)if(L.type==="childList")for(const $ of L.addedNodes)$.tagName==="LINK"&&$.rel==="modulepreload"&&v($)}).observe(document,{childList:!0,subtree:!0});function M(D){const L={};return D.integrity&&(L.integrity=D.integrity),D.referrerPolicy&&(L.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?L.credentials="include":D.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(D){if(D.ep)return;D.ep=!0;const L=M(D);fetch(D.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(N,M,v){let D=Promise.resolve();if(M&&M.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const $=document.querySelector("meta[property=csp-nonce]"),nl=$?.nonce||$?.getAttribute("nonce");D=U(M.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const B=document.createElement("link");if(B.rel=Q?"stylesheet":ny,Q||(B.as="script"),B.crossOrigin="",B.href=T,nl&&B.setAttribute("nonce",nl),document.head.appendChild(B),Q)return new Promise((fl,Al)=>{B.addEventListener("load",fl),B.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function L($){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=$,window.dispatchEvent(nl),!nl.defaultPrevented)throw $}return D.then($=>{for(const nl of $||[])nl.status==="rejected"&&L(nl.reason);return N().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ef={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.fragment");function M(v,D,L){var $=null;if(L!==void 0&&($=""+L),D.key!==void 0&&($=""+D.key),"key"in D){L={};for(var nl in D)nl!=="key"&&(L[nl]=D[nl])}else L=D;return D=L.ref,{$$typeof:o,type:v,key:$,ref:D!==void 0?D:null,props:L}}return Gu.Fragment=N,Gu.jsx=M,Gu.jsxs=M,Gu}var Mr;function sy(){return Mr||(Mr=1,Ef.exports=fy()),Ef.exports}var y=sy(),zf={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),$=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.iterator;function fl(d){return d===null||typeof d!="object"?null:(d=B&&d[B]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rl=Object.assign,F={};function zl(d,m,O){this.props=d,this.context=m,this.refs=F,this.updater=O||Al}zl.prototype.isReactComponent={},zl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},zl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Dl(){}Dl.prototype=zl.prototype;function ql(d,m,O){this.props=d,this.context=m,this.refs=F,this.updater=O||Al}var Ol=ql.prototype=new Dl;Ol.constructor=ql,Rl(Ol,zl.prototype),Ol.isPureReactComponent=!0;var Sl=Array.isArray;function rl(){}var I={H:null,A:null,T:null,S:null},Nl=Object.prototype.hasOwnProperty;function at(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function Pl(d,m){return at(d.type,m,d.props)}function wl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ul(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function bl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ul(""+d.key):m.toString(36)}function tt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(rl,rl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var V=typeof d;(V==="undefined"||V==="boolean")&&(d=null);var P=!1;if(d===null)P=!0;else switch(V){case"bigint":case"string":case"number":P=!0;break;case"object":switch(d.$$typeof){case o:case N:P=!0;break;case Q:return P=d._init,p(P(d._payload),m,O,x,J)}}if(P)return J=J(d),P=x===""?"."+bl(d,0):x,Sl(J)?(O="",P!=null&&(O=P.replace(pt,"$&/")+"/"),p(J,m,O,"",function(fe){return fe})):J!=null&&(wl(J)&&(J=Pl(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+P)),m.push(J)),1;P=0;var Gl=x===""?".":x+":";if(Sl(d))for(var pl=0;pl>>1,ol=p[sl];if(0>>1;slD(O,C))xD(J,O)?(p[sl]=J,p[x]=C,sl=x):(p[sl]=O,p[m]=C,sl=m);else if(xD(J,C))p[sl]=J,p[x]=C,sl=x;else break l}}return j}function D(p,j){var C=p.sortIndex-j.sortIndex;return C!==0?C:p.id-j.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var $=Date,nl=$.now();o.unstable_now=function(){return $.now()-nl}}var U=[],T=[],Q=1,R=null,B=3,fl=!1,Al=!1,Rl=!1,F=!1,zl=typeof setTimeout=="function"?setTimeout:null,Dl=typeof clearTimeout=="function"?clearTimeout:null,ql=typeof setImmediate<"u"?setImmediate:null;function Ol(p){for(var j=M(T);j!==null;){if(j.callback===null)v(T);else if(j.startTime<=p)v(T),j.sortIndex=j.expirationTime,N(U,j);else break;j=M(T)}}function Sl(p){if(Rl=!1,Ol(p),!Al)if(M(U)!==null)Al=!0,rl||(rl=!0,Ul());else{var j=M(T);j!==null&&tt(Sl,j.startTime-p)}}var rl=!1,I=-1,Nl=5,at=-1;function Pl(){return F?!0:!(o.unstable_now()-atp&&Pl());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,B=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,Ol(p),j=!0;break t}R===M(U)&&v(U),Ol(p)}else v(U);R=M(U)}if(R!==null)j=!0;else{var d=M(T);d!==null&&tt(Sl,d.startTime-p),j=!1}}break l}finally{R=null,B=C,fl=!1}j=void 0}}finally{j?Ul():rl=!1}}}var Ul;if(typeof ql=="function")Ul=function(){ql(wl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,bl=pt.port2;pt.port1.onmessage=wl,Ul=function(){bl.postMessage(null)}}else Ul=function(){zl(wl,0)};function tt(p,j){I=zl(function(){p(o.unstable_now())},j)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=C,N(T,p),M(U)===null&&p===M(T)&&(Rl?(Dl(I),I=-1):Rl=!0,tt(Sl,C-sl))):(p.sortIndex=ol,N(U,p),Al||fl||(Al=!0,rl||(rl=!0,Ul()))),p},o.unstable_shouldYield=Pl,o.unstable_wrapCallback=function(p){var j=B;return function(){var C=B;B=j;try{return p.apply(this,arguments)}finally{B=C}}}})(_f)),_f}var Ur;function ry(){return Ur||(Ur=1,Tf.exports=oy()),Tf.exports}var Af={exports:{}},lt={};var Cr;function my(){if(Cr)return lt;Cr=1;var o=Of();function N(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),Af.exports=my(),Af.exports}var Hr;function yy(){if(Hr)return Xu;Hr=1;var o=ry(),N=Of(),M=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),V=d(null),P=d(null);function Gl(l,t){switch(O(V,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?$o(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=$o(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function pl(){m(x),m(J),m(V)}function fe(l){l.memoizedState!==null&&O(P,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),P.current===l&&(m(P),Ru._currentValue=C)}var la,La;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",La=-1)":-1u||f[a]!==g[u]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Vt(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Zt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Vt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,Ka=o.unstable_scheduleCallback,Ja=o.unstable_cancelCallback,b=o.unstable_shouldYield,q=o.unstable_requestPaint,K=o.unstable_now,ot=o.unstable_getCurrentPriorityLevel,Cl=o.unstable_ImmediatePriority,Ht=o.unstable_UserBlockingPriority,rt=o.unstable_NormalPriority,Mf=o.unstable_LowPriority,na=o.unstable_IdlePriority,se=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,mt=null;function de(l){if(typeof se=="function"&&Zr(l),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(wa,l)}catch{}}var vt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Zu=256,Vu=262144,Lu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ku(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function $a(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Lu;return Lu<<=1,(Lu&62914560)===0&&(Lu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,g=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&$u(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function oa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,Ei=null,ku=null;function $f(){if(ku)return ku;var l,t=Ei,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ya=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ya)return l==="compositionend"||!Ai&&es(l,t)?(l=$f(),ku=Ei=re=null,ya=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=$u(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=$u(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ha=null,Di=null,iu=null,Ni=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ha==null||ha!==$u(a)||(a=ha,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Ln(Di,"onSelect"),0>=i,u-=i,Yt=1<<32-vt(t)+u|e<k?(al=Y,Y=null):al=Y.sibling;var cl=S(r,Y,h[k],_);if(cl===null){Y===null&&(Y=al);break}l&&Y&&cl.alternate===null&&t(r,Y),s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl,Y=al}if(k===h.length)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;kk?(al=Y,Y=null):al=Y.sibling;var He=S(r,Y,cl.value,_);if(He===null){Y===null&&(Y=al);break}l&&Y&&He.alternate===null&&t(r,Y),s=n(He,s,k),il===null?G=He:il.sibling=He,il=He,Y=al}if(cl.done)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;!cl.done;k++,cl=h.next())cl=A(r,cl.value,_),cl!==null&&(s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl);return ul&&$t(r,k),G}for(Y=a(Y);!cl.done;k++,cl=h.next())cl=E(Y,r,k,cl.value,_),cl!==null&&(l&&cl.alternate!==null&&Y.delete(cl.key===null?k:cl.key),s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl);return l&&Y.forEach(function(uy){return t(r,uy)}),ul&&$t(r,k),G}function gl(r,s,h,_){if(typeof h=="object"&&h!==null&&h.type===Rl&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case fl:l:{for(var G=h.key;s!==null;){if(s.key===G){if(G=h.type,G===Rl){if(s.tag===7){e(r,s.sibling),_=u(s,h.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Nl&&we(G)===s.type){e(r,s.sibling),_=u(s,h.props),ru(_,h),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}h.type===Rl?(_=Ze(h.props.children,r.mode,_,h.key),_.return=r,r=_):(_=cn(h.type,h.key,h.props,null,r.mode,_),ru(_,h),_.return=r,r=_)}return i(r);case Al:l:{for(G=h.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===h.containerInfo&&s.stateNode.implementation===h.implementation){e(r,s.sibling),_=u(s,h.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Bi(h,r.mode,_),_.return=r,r=_}return i(r);case Nl:return h=we(h),gl(r,s,h,_)}if(tt(h))return H(r,s,h,_);if(Ul(h)){if(G=Ul(h),typeof G!="function")throw Error(v(150));return h=G.call(h),Z(r,s,h,_)}if(typeof h.then=="function")return gl(r,s,vn(h),_);if(h.$$typeof===ql)return gl(r,s,dn(r,h),_);yn(r,h)}return typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint"?(h=""+h,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,h),_.return=r,r=_):(e(r,s),_=qi(h,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,h,_){try{ou=0;var G=gl(r,s,h,_);return Ma=null,G}catch(Y){if(Y===Oa||Y===rn)throw Y;var il=ht(29,Y,null,r.mode);return il.lanes=_,il.return=r,il}}}var We=Ys(!0),Gs=Ys(!1),ge=!1;function Wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=nn(l),ps(l,null,e),t}return un(l,a,t,e),nn(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=Aa;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,g=f.next;f.next=null,i===null?n=g:i.next=g,i=f;var z=l.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=g:c.next=g,z.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,z=g=f=null,c=n;do{var S=c.lane&-536870913,E=S!==c.lane;if(E?(el&S)===S:(a&S)===S){S!==0&&S===_a&&(Ii=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var H=l,Z=c;S=t;var gl=e;switch(Z.tag){case 1:if(H=Z.payload,typeof H=="function"){A=H.call(gl,A,S);break l}A=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=Z.payload,S=typeof H=="function"?H.call(gl,A,S):H,S==null)break l;A=R({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,E&&(l.flags|=8192),E=u.callbacks,E===null?u.callbacks=[S]:E.push(S))}else E={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(g=z=E,f=A):z=z.next=E,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;E=c,c=E.next,E.next=null,u.lastBaseUpdate=E,u.shared.pending=null}}while(!0);z===null&&(f=A),u.baseState=f,u.firstBaseUpdate=g,u.lastBaseUpdate=z,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,gc(l,!1,t,e);try{var f=u(),g=p.S;if(g!==null&&g(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=wm(f,a);Su(l,t,z,zt(l))}else Su(l,t,a,zt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},zt())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,C,e===null?Pm:function(){return Ed(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Ed(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},zt())}function hc(){return kl(Ru)}function zd(){return Yl().memoizedState}function pd(){return Yl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=zt();l=Se(e);var a=be(t,l,e);a!==null&&(dt(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=zt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},An(l)?_d(t,e):(e=Hi(l,t,e,a),e!==null&&(dt(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=zt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(An(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,yt(c,i))return un(l,t,u,0),El===null&&an(),!1}catch{}if(e=Hi(l,t,u,a),e!==null)return dt(e,l,a),Ad(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:Wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},An(l)){if(t)throw Error(v(479))}else t=Hi(l,e,a,2),t!==null&&dt(t,l,2)}function An(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Da=Sn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:kl,use:zn,useCallback:xl,useContext:xl,useEffect:xl,useImperativeHandle:xl,useLayoutEffect:xl,useInsertionEffect:xl,useMemo:xl,useReducer:xl,useRef:xl,useState:xl,useDebugValue:xl,useDeferredValue:xl,useTransition:xl,useSyncExternalStore:xl,useId:xl,useHostTransitionStatus:xl,useFormState:xl,useActionState:xl,useOptimistic:xl,useMemoCache:xl,useCacheRefresh:xl};bu.useEffectEvent=xl;var Od={readContext:kl,use:zn,useCallback:function(l,t){return et().memoizedState=[l,t===void 0?null:t],l},useContext:kl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,Tn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return Tn(4194308,4,l,t)},useInsertionEffect:function(l,t){Tn(4,2,l,t)},useMemo:function(l,t){var e=et();t=t===void 0?null:t;var a=l();if(ke){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=et();if(e!==void 0){var u=e(t);if(ke){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=et();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=et();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),et().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=et();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),El===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Ua(9,{destroy:void 0},$s.bind(null,a,n,e,t),null),e},useId:function(){var l=et(),t=El.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-vt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=bn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[$l]=t,n[ut]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch(Il(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return _l(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=V.current,pa(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=Wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[$l]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ye(t,!0)}else l=Kn(l).createTextNode(a),l[$l]=t,t.stateNode=l}return _l(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=pa(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[$l]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(St(t),t):(St(t),null);if((t.flags&128)!==0)throw Error(v(558))}return _l(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=pa(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[$l]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(St(t),t):(St(t),null)}return St(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Nn(t,t.updateQueue),_l(t),null);case 4:return pl(),l===null&&Pc(t.stateNode.containerInfo),_l(t),null;case 10:return kt(t.type),_l(t),null;case 19:if(m(Bl),a=t.memoizedState,a===null)return _l(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Hl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=gn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Nn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Bl,Bl.current&1|2),ul&&$t(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&K()>Rn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=gn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Nn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return _l(t),null}else 2*K()-a.renderingStartTime>Rn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=K(),l.sibling=null,e=Bl.current,O(Bl,u?e&1|2:e&1),ul&&$t(t,a.treeForkCount),l):(_l(t),null);case 22:case 23:return St(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(_l(t),t.subtreeFlags&6&&(t.flags|=8192)):_l(t),e=t.updateQueue,e!==null&&Nn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Xl),_l(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Xl),pl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(St(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(St(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Bl),null;case 4:return pl(),null;case 10:return kt(t.type),null;case 22:case 23:return St(t),lc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Xl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:kt(Xl),pl();break;case 26:case 27:case 5:Tt(t);break;case 4:pl();break;case 31:t.memoizedState!==null&&St(t);break;case 13:St(t);break;case 19:m(Bl);break;case 10:kt(t.type);break;case 22:case 23:St(t),lc(),l!==null&&m(Je);break;case 24:kt(Xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){vl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,g=c;try{g()}catch(z){vl(u,f,z)}}}a=a.next}while(a!==n)}}catch(z){vl(t,t.return,z)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){vl(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){vl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){vl(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){vl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){vl(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){vl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[ut]=t}catch(u){vl(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function xc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Hc(l,t,e),l=l.sibling;l!==null;)Hc(l,t,e),l=l.sibling}function Un(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Un(l,t,e),l=l.sibling;l!==null;)Un(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Il(t,a,e),t[$l]=l,t[ut]=e}catch(n){vl(l,l.return,n)}}var te=!1,Vl=!1,Rc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Jl=null;function cv(l,t){if(l=l.containerInfo,ef=In,l=vs(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,g=0,z=0,A=l,S=null;t:for(;;){for(var E;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(E=A.firstChild)!==null;)S=A,A=E;for(;;){if(A===l)break t;if(S===e&&++g===u&&(c=i),S===n&&++z===a&&(f=i),(E=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=E}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},In=!1,Jl=t;Jl!==null;)if(t=Jl,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Jl=l;else for(;Jl!==null;){switch(t=Jl,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),Il(n,a,e),n[$l]=l,Kl(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cgl&&(i=gl,gl=Z,Z=i);var r=rs(c,Z),s=rs(c,gl);if(r&&s&&(E.rangeCount!==1||E.anchorNode!==r.node||E.anchorOffset!==r.offset||E.focusNode!==s.node||E.focusOffset!==s.offset)){var h=A.createRange();h.setStart(r.node,r.offset),E.removeAllRanges(),Z>gl?(E.addRange(h),E.extend(s.node,s.offset)):(h.setEnd(s.node,s.offset),E.addRange(h))}}}}for(A=[],E=c;E=E.parentNode;)E.nodeType===1&&A.push({element:E,left:E.scrollLeft,top:E.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Ll=0,qa=Oe=null,ie=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,p.T=a,Co(l,t)}}function Ho(l,t,e){t=Mt(e,t),t=zc(l.stateNode,t,2),l=be(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function vl(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Hd(2),a=be(t,e,2),a!==null&&(Rd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,El===l&&(el&e)===e&&(Hl===4||Hl===3&&(el&62914560)===el&&300>K()-Hn?(dl&2)===0&&Ba(l,0):Gc|=e,Ra===el&&(Ra=0)),Qt(l)}function Ro(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Ro(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Ro(l,e)}function Sv(l,t){return Ka(l,t)}var Qn=null,Ga=null,wc=!1,Zn=!1,$c=!1,je=0;function Qt(l){l!==Ga&&l.next===null&&(Ga===null?Qn=Ga=l:Ga=Ga.next=l),Zn=!0,wc||(wc=!0,Ev())}function Du(l,t){if(!$c&&Zn){$c=!0;do for(var e=!1,a=Qn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-vt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Ku(a,a===El?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||$a(a,n)||(e=!0,Go(a,n));a=a.next}while(e);$c=!1}}function bv(){qo()}function qo(){Zn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=K(),e=null,a=Qn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Qn=u:e.next=u,u===null&&(Ga=e)):(e=a,(l!==0||(n&3)!==0)&&(Zn=!0)),a=u}Ll!==0&&Ll!==5||Du(l),je!==0&&(je=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var z=f.transferSize,A=f.initiatorType;z&&wo(A)&&(f=f.responseEnd,i+=z*(f"u"?null:document;function nr(l,t,e){var a=Xa;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Il(t,"link",l),Kl(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Xa;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Qa(l);break;case"script":n=Za(l)}xt.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),xt.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(xu(n))||t==="script"&&a.querySelector(Hu(n))||(t=a.createElement("link"),Il(t,"link",l),Kl(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Xa;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Za(l)}if(!xt.has(n)&&(l=R({rel:"modulepreload",href:l},t),xt.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Hu(n)))return}a=e.createElement("link"),Il(a,"link",l),Kl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Xa;if(a&&l){var u=sa(a).hoistableStyles,n=Qa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(xu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=xt.get(n))&&of(l,e);var f=i=a.createElement("link");Kl(f),Il(f,"link",l),f._p=new Promise(function(g,z){f.onload=g,f.onerror=z}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,wn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Kl(n),Il(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Kl(n),Il(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=V.current)?Jn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Qa(e.href),e=sa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Qa(e.href);var n=sa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(xu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),xt.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},xt.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Za(e),e=sa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Qa(l){return'href="'+At(l)+'"'}function xu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Il(t,"link",e),Kl(t),l.head.appendChild(t))}function Za(l){return'[src="'+At(l)+'"]'}function Hu(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Kl(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Kl(a),Il(a,"style",u),wn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Qa(e.href);var n=l.querySelector(xu(u));if(n)return t.state.loading|=4,t.instance=n,Kl(n),n;a=cr(e),(u=xt.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Kl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Il(n,"link",a),t.state.loading|=4,wn(n,e.precedence,l),t.instance=n;case"script":return n=Za(e.src),(u=l.querySelector(Hu(n)))?(t.instance=u,Kl(u),u):(a=e,(u=xt.get(n))&&(a=R({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Kl(u),Il(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wn(a,e.precedence,l));return t.instance}function wn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function $v(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Qa(a.href),n=t.querySelector(xu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Kl(n);return}n=t.ownerDocument||t,a=cr(a),(u=xt.get(u))&&of(a,u),n=n.createElement("link"),Kl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Il(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&Fn(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var kn=null;function Fn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,kn=new Map,t.forEach(kv,l),kn=null,Wn.call(l))}function kv(l,t){if(!(t.state.loading&4)){var e=kn.get(l);if(e)var a=e.get(null);else{e=new Map,kn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),pf.exports=yy(),pf.exports}var gy=hy();const jl={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const N=o.camera;if(jl.camera==="head")o.controls.target.set(0,10,0),N.position.set(10,12,18);else{o.controls.target.set(0,0,0);const M=48;jl.camera==="front"?N.position.set(0,0,M):jl.camera==="back"?N.position.set(0,0,-M):N.position.set(23,7,42)}N.lookAt(o.controls.target),N.updateProjectionMatrix(),o.controls.update()}function Gr(){jl.syncing=!0;try{jl.viewers.forEach(o=>Sy(o.viewer))}finally{jl.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===jl.camera))}function by(o){if(!jl.syncing){jl.syncing=!0;try{for(const{viewer:N}of jl.viewers)N!==o&&(N.camera.position.copy(o.camera.position),N.camera.quaternion.copy(o.camera.quaternion),N.camera.zoom=o.camera.zoom,N.controls.target.copy(o.controls.target),N.camera.updateProjectionMatrix(),N.controls.update())}finally{jl.syncing=!1}}}function Ey(o,N,M){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:jl.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>by(D));const L=new ResizeObserver(()=>{!D.disposed&&o.clientWidth&&o.clientHeight&&(D.width=o.clientWidth,D.height=o.clientHeight)});L.observe(o),jl.viewers.push({viewer:D,observer:L}),Promise.resolve(D.loadSkin(N.url,{model:"default"})).then(()=>{M!==jl.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(jl.outerLayer),v.hidden=!0)}).catch(()=>{M===jl.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function zy(o,N){Ey(o,N,jl.generation),Gr();const M=jl.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||jl.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),jl.viewers=jl.viewers.filter(v=>v!==M))}}function py(o,N,M){const v=jl.camera!==o;Object.assign(jl,{camera:o,outerLayer:N,uvOnly:M}),v&&Gr(),jl.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(N),D.renderPaused=M})}async function Qu(o,N,M){const v=await fetch("/api/meat-model/"+o,N===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const N={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别五类标注",complete:"已完成",failed:"失败"},M=o?.progress;return(N[o?.stage]||"正在预选")+(M?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型",surface_control:"旧结构对照",face_v8:"面部解码器"}[M.variant]||"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,N]=X.useState(null),[M,v]=X.useState(""),[D,L]=X.useState(!1),$=X.useRef(!0),nl=X.useRef(null),U=X.useRef(!1),T=async()=>{try{const B=await Qu("status");$.current&&(N(B),v(""))}catch(B){$.current&&v(B.message)}};X.useEffect(()=>{$.current=!0,T();const B=()=>T();return window.addEventListener("meat-saved",B),nl.current=setInterval(T,1e4),()=>{$.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",B)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const B=await Qu("train",{});$.current&&N(fl=>({...fl,training:B}))}catch(B){$.current&&v(B.message)}finally{U.current=!1,$.current&&(L(!1),T())}}};return y.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Meat 预选模型"}),y.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),y.jsx("p",{children:"当前模型预选裸露皮肤、眼睛、嘴巴、眉毛和胡子,保留已有眼影、鼻子。仅在点击训练按钮时更新模型;保存标注不会自动训练。旧模型训练时将眼影、鼻子归入裸露皮肤,七类原始标注保持不变;未细标格仍用于二分类。"}),o?.dataset&&y.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),y.jsxs("div",{className:"meat-model-actions",children:[y.jsx("button",{className:"button",onClick:R,disabled:D||Q||!o?.active||o?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),y.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&y.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?o.training.promoted===!1?" · 候选已完成,尚未替换当前模型":" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&y.jsxs("small",{children:["历史皮肤分组验证 · meat 二分类 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是五类准确率或新皮肤准确率,预选仍需人工检查。"]}),o?.active?.fine_metrics&&y.jsxs("p",{children:["已知细标的留出召回:",Object.entries({1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"}).map(([B,fl])=>`${fl} ${((o.active.fine_metrics[B]?.recall||0)*100).toFixed(1)}%`).join(" · "),"。细标含人工与助手来源。"]}),!!o?.dataset?.excluded?.length&&y.jsxs("details",{children:[y.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((B,fl)=>y.jsxs("p",{children:[B.id,":",B.reason]},fl))]}),M&&y.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function Uy({data:o,disabled:N,onStart:M,onEnd:v,onApply:D,hint:L}){const[$,nl]=X.useState("precision"),[U,T]=X.useState(!1);X.useEffect(()=>{let Ol=!0;return Qu("status").then(Sl=>{Ol&&T(Sl.active?.architecture==="face_v8")}).catch(()=>{}),()=>{Ol=!1}},[]);const[Q,R]=X.useState(!1),[B,fl]=X.useState(""),[Al,Rl]=X.useState(""),F=X.useRef(!0),zl=X.useRef(null),Dl=X.useRef(!1);X.useEffect(()=>(F.current=!0,()=>{F.current=!1,zl.current?.abort()}),[]);const ql=async()=>{if(Dl.current)return;Dl.current=!0,R(!0),Rl(""),fl("正在请求预选…"),M(),zl.current=new AbortController;const Ol=zl.current.signal;try{let Sl=await Qu("predict",{key:o.key,skin_revision:o.skin_revision,preselection_policy:$},Ol);for(;!Xr(Sl.stage);){if(!F.current||(fl(Qr(Sl)),await new Promise(rl=>setTimeout(rl,1500)),!F.current))return;Sl=await Qu("job?id="+encodeURIComponent(Sl.id),void 0,Ol)}if(Sl.stage==="failed")throw Error(Sl.error||"预选失败,请稍后重试");if(Sl.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");if(F.current){D(Sl.prediction);const rl=Sl.prediction,I={1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"},Nl=rl.semantic_available?Object.entries(I).map(([at,Pl])=>`${Pl} ${rl.category_counts?.[at]||0} 格`).join(" · "):`${rl.selected.length} 格 meat(当前旧模型仅支持二分类,已有细分类保留)`;fl(`预选来自 ${rl.model_id}${rl.preselection_policy?` · ${rl.preselection_policy==="precision"?"优先减少误选":"均衡召回"}`:""} · ${Nl}${rl.uncertain_count?` · ${rl.uncertain_count} 格不确定,已保持未选,请复核`:""}。切换类别查看高亮;请检查并修改,再保存。`)}}catch(Sl){F.current&&Sl.name!=="AbortError"&&(Rl(Sl.message),fl(""))}finally{Dl.current=!1,F.current&&(R(!1),v())}};return y.jsxs("div",{className:"meat-preselect",children:[y.jsx("button",{className:"button secondary",onClick:ql,disabled:N||Q||o.model!=="classic",children:Q?"五类预选中…":"模型预选五类"}),y.jsxs("label",{children:["预选方式 ",y.jsxs("select",{"aria-label":"预选方式",value:$,disabled:N||Q||!U,onChange:Ol=>nl(Ol.target.value),children:[y.jsx("option",{value:"precision",children:"优先减少误选"}),y.jsx("option",{value:"balanced",children:"均衡召回"})]})]}),!U&&y.jsx("small",{children:"当前模型不支持切换预选方式;启用面部模型后可用。"}),y.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":L||"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),B&&y.jsx("p",{role:"status",children:B}),Al&&y.jsx("p",{role:"alert",className:"meat-warning",children:Al})]})}const _y=X.lazy(()=>Yr(()=>import("./SkinEditor-D4aKozkb.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=X.lazy(()=>Yr(()=>import("./MeatEditor-0DhnHy7F.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ni=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,N)=>N==="all"||N==="perfect"&&!!o.perfect||N==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||N==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||N==="best"&&!!o.best||N==="ordinary"&&!!o.best&&!o.perfect||o.rejection===N,Br=o=>o.version==="original"?"原版":o.version;async function ii(o,N){const M=await fetch(o,N===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const N=X.useRef(null);return X.useEffect(()=>zy(N.current,o),[o.url]),y.jsxs("div",{className:"skin-stage",ref:N,children:[y.jsx("canvas",{}),y.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,N]=X.useState([]),[M,v]=X.useState(null),[D,L]=X.useState("pending"),[$,nl]=X.useState("all"),[U,T]=X.useState(""),[Q,R]=X.useState(""),[B,fl]=X.useState(new Set),[Al,Rl]=X.useState([]),[F,zl]=X.useState(!1),[Dl,ql]=X.useState(null),[Ol,Sl]=X.useState("angle"),[rl,I]=X.useState(!0),[Nl,at]=X.useState(!1),[Pl,wl]=X.useState(null),[Ul,pt]=X.useState(null),[bl,tt]=X.useState(null),[p,j]=X.useState(!1),C=X.useRef(!1),sl=X.useRef(null),ol=X.useRef(null),d=X.useRef(null),m=o.find(b=>b.key===M),O=(b,q=D,K=U,ot=Q,Cl=$)=>(!K||ni(b)===K)&&b.id.toLowerCase().includes(ot.trim().toLowerCase())&&(q==="all"||q==="pending"&&b.results.length>0&&!Re(b)||q==="done"&&Re(b)&&My(b,Cl)||q==="rejected"&&!!b.rejection||q==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,V=(b,q=!1)=>ql({message:b,error:q}),P=(b,q=!0)=>{C.current||(q&&M&&M!==b&&Rl(K=>[...K,M]),v(b))},Gl=(b=D,q=U,K=Q,ot=B)=>o.find(Cl=>O(Cl,b,q,K)&&!ot.has(Cl.key))?.key||null,pl=(b=o,q=B)=>{const K=b.filter(Cl=>O(Cl)&&!q.has(Cl.key)&&Cl.key!==M),ot=b.findIndex(Cl=>Cl.key===M);P((K.find(Cl=>b.indexOf(Cl)>ot)||K[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,zl(!0);try{const q=await ii(b?"/api/refresh":"/api/state",b?{}:void 0);N(q.items),v(q.items.find(K=>K.key===M&&O(K))?.key||q.items.find(K=>O(K)&&!B.has(K.key))?.key||null),b&&V("目录已刷新")}catch(q){V(q.message,!0)}finally{C.current=!1,zl(!1)}}}async function Tt(b,q,K){if(!(C.current||!m)){C.current=!0,zl(!0);try{const ot=await ii("/api/"+b,{key:m.key,revision:m.revision,result:q?.name,reason:typeof q=="string"?q:void 0,png:K}),Cl=o.map(rt=>rt.key===M?ot.item:rt);N(Cl);const Ht=new Set(B);Ht.delete(M),fl(Ht),C.current=!1,pt(null),b!=="clear"&&pl(Cl,Ht),V(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(ot){V(ot.message,!0)}finally{C.current=!1,zl(!1)}}}async function la(b=m){if(!(C.current||!b?.perfect)){C.current=!0,zl(!0);try{const q=await ii("/api/meat-labels?key="+encodeURIComponent(b.key));j(!1),tt(q)}catch(q){V(q.message,!0)}finally{C.current=!1,zl(!1)}}}const La=()=>{C.current||p&&!window.confirm("分类标注尚未保存,放弃本次修改?")||(tt(null),j(!1))};async function Zt(b,q,K,ot=!1){if(!(C.current||!bl)){C.current=!0,zl(!0);try{const Cl=await ii("/api/meat-labels",{key:bl.key,revision:bl.revision,skin_revision:bl.skin_revision,meat_revision:bl.meat_revision,semantic_revision:bl.semantic.semantic_revision,labels:b,assistance:K,fine_review_complete:ot});window.dispatchEvent(new Event("meat-saved"));const Ht=o.map(rt=>rt.key===bl.key?Cl.item:rt);if(N(Ht),tt(null),j(!1),V("分类已保存 · "+bl.id+" · "+b.filter(Boolean).length+" 格"),C.current=!1,q){const rt=Ht.findIndex(se=>se.key===bl.key),na=[...Ht.slice(rt+1),...Ht.slice(0,rt)].find(se=>se.perfect&&se.meat_status!=="saved"&&(!U||ni(se)===U)&&se.id.toLowerCase().includes(Q.trim().toLowerCase()));na?(P(na.key),await la(na)):V("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Cl){V(Cl.message,!0)}finally{C.current=!1,zl(!1)}}}function ta(){if(C.current||!m)return;const b=new Set(B);b.add(M),fl(b),pl(o,b)}function ea(){!C.current&&Al.length&&(v(Al.at(-1)),Rl(Al.slice(0,-1)))}X.useEffect(()=>{fe()},[]),X.useEffect(()=>py(Ol,rl,Nl),[Ol,rl,Nl,M]),X.useEffect(()=>{if(!Dl)return;const b=setTimeout(()=>ql(null),Dl.error?8e3:3500);return()=>clearTimeout(b)},[Dl]),X.useEffect(()=>{Pl&&sl.current?.showModal()},[Pl]),X.useEffect(()=>{Ul&&ol.current?.showModal()},[Ul]),X.useEffect(()=>{bl&&d.current?.showModal()},[bl]),X.useEffect(()=>{const b=q=>{if(!(F||Pl||Ul||bl||q.ctrlKey||q.metaKey||q.altKey||q.target.closest("input,select,textarea,[contenteditable]"))){if(q.key.toLowerCase()==="s")q.preventDefault(),ta();else if(q.key==="ArrowLeft")q.preventDefault(),ea();else if(q.key==="ArrowRight")q.preventDefault(),pl();else if(/^[1-9]$/.test(q.key)){const K=m?.results[+q.key-1];K&&(q.preventDefault(),Tt("choose",K))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Vt=o.filter(b=>!U||ni(b)===U),aa=Vt.filter(Re).length,ua=aa+Vt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Vt.filter(Re).length,pending:Vt.filter(b=>b.results.length&&!Re(b)).length,rejected:Vt.filter(b=>b.rejection).length,all:Vt.length,no_results:Vt.filter(b=>!b.results.length).length},Ja=b=>{C.current||(L(b),P(Gl(b)))};return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-icon",children:"D"}),y.jsxs("div",{children:[y.jsx("h1",{children:"DDJ 最佳结果标注"}),y.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),y.jsxs("div",{className:"progress",children:[y.jsxs("div",{children:[y.jsx("span",{children:"标注进度"}),y.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),y.jsx("div",{className:"progress-track",children:y.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),y.jsx("button",{id:"refresh",className:"button secondary",disabled:F,onClick:()=>fe(!0),children:"刷新目录"})]}),y.jsxs("section",{className:"filters",children:[y.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,q])=>y.jsxs("button",{"data-filter":b,disabled:F,className:D===b?"active":"",onClick:()=>Ja(b),children:[q," ",y.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),y.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:F,value:U,onChange:b=>{T(b.target.value),P(Gl(D,b.target.value))},children:[y.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ni))].map(b=>y.jsx("option",{children:b},b))]}),y.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:F,value:Q,onChange:b=>{R(b.target.value),P(Gl(D,U,b.target.value))}})]}),D==="done"&&y.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[y.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),y.jsx("select",{id:"annotationType",disabled:F,value:$,onChange:b=>{const q=b.target.value;nl(q),P(o.find(K=>O(K,"done",U,Q,q)&&!B.has(K.key))?.key||null)},children:Object.entries(Oy).map(([b,q])=>y.jsxs("option",{value:b,children:[q," ·"," ",o.filter(K=>O(K,"done",U,Q,b)).length]},b))}),y.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),y.jsx(Ty,{}),y.jsx("main",{children:m?y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"item-heading",children:[y.jsxs("div",{children:[y.jsx("span",{className:"eyebrow",children:m.folder}),y.jsx("h2",{id:"itemId",children:m.id}),y.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),y.jsxs("div",{className:"jump",children:[y.jsx("label",{htmlFor:"jump",children:"跳转条目"}),y.jsx("select",{id:"jump",disabled:F,value:M,onChange:b=>{const q=new Set(B);q.delete(b.target.value),fl(q),P(b.target.value)},children:J.map(b=>y.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),y.jsxs("div",{className:"workspace",id:"workspace",children:[y.jsxs("aside",{className:"source-panel panel",children:[y.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,q,K])=>y.jsxs("section",{className:"reference-image",children:[y.jsxs("div",{className:"panel-title",children:[y.jsxs("h3",{children:[b," · ",q]}),y.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),y.jsx("button",{hidden:!K,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>wl({url:K,title:m.id+"_"+b}),children:y.jsx("img",{id:b+"Image",src:K||void 0,alt:q})}),b==="edited"&&y.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!K,children:"暂无 edited 图片"})]},b))}),y.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),y.jsxs("div",{className:"reject-actions",children:[y.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:F||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),y.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:F||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),y.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[y.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),y.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&y.jsx("button",{className:"text-button",onClick:()=>wl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&y.jsxs("div",{className:"meat-entry",children:[y.jsx("button",{id:"annotateMeat",className:"button",disabled:F,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑分类":"标注皮肤分类"}),y.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),y.jsx("button",{id:"clearBest",className:"text-button",disabled:F,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),y.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),y.jsxs("section",{className:"comparison",children:[y.jsxs("div",{className:"comparison-toolbar",children:[y.jsxs("div",{className:"camera-buttons",children:[y.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,q])=>y.jsx("button",{"data-camera":b,className:Ol===b?"active":"",onClick:()=>Sl(b),children:q},b))]}),y.jsxs("div",{className:"view-options",children:[y.jsxs("label",{children:[y.jsx("input",{id:"outerLayer",type:"checkbox",checked:rl,onChange:b=>I(b.target.checked)}),"显示外层"]}),y.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Nl,onClick:()=>at(!Nl),children:Nl?"显示 3D":"只看 UV"})]})]}),y.jsxs("div",{id:"results",className:"result-grid"+(Nl?" uv-only":""),children:[m.results.map((b,q)=>y.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[y.jsxs("div",{className:"result-header",children:[y.jsx("span",{className:"version-name",children:Br(b)}),y.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":q+1})]}),y.jsx(jy,{result:b}),y.jsxs("div",{className:"uv-area",children:[y.jsx("button",{className:"uv-button",onClick:()=>wl({url:b.url,title:b.name,pixelated:!0}),children:y.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),y.jsxs("div",{className:"uv-caption",children:[y.jsx("strong",{children:"UV 贴图"}),y.jsx("span",{children:"点击放大"})]})]}),y.jsxs("div",{className:"result-actions",children:[y.jsx("div",{className:"result-file",children:b.name}),y.jsx("button",{className:"choose-button",disabled:F||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),y.jsx("button",{className:"perfect-button",disabled:F||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),y.jsx("button",{className:"repair-button",disabled:F,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&y.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),y.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):y.jsxs("section",{id:"empty",className:"empty panel",children:[y.jsx("h2",{children:"当前筛选下没有更多条目"}),y.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),y.jsx("button",{id:"resume",className:"button primary",disabled:F,onClick:()=>{fl(new Set),L("pending"),T(""),R(""),P(Gl("pending","","",new Set))},children:"继续查看待标注"})]})}),y.jsxs("footer",{className:"footer",children:[y.jsxs("div",{className:"navigation",children:[y.jsx("button",{id:"previous",className:"button secondary",disabled:F||!Al.length,onClick:ea,children:"← 上一个"}),y.jsx("button",{id:"skip",className:"button secondary",disabled:F||!m,onClick:ta,children:"暂时忽略 →"})]}),y.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),y.jsxs("span",{children:["本次已忽略 ",B.size," 项 · 忽略不保存"]})]}),Dl&&y.jsx("div",{id:"toast",role:"status",className:"toast"+(Dl.error?" error":""),children:Dl.message}),Pl&&y.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>wl(null),onClick:b=>{b.target===b.currentTarget&&wl(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsx("span",{children:Pl.title}),y.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>wl(null),children:"关闭 ×"})]}),y.jsx("div",{className:"dialog-image",children:y.jsx("img",{id:"dialogImage",src:Pl.url,alt:"放大预览",className:Pl.pixelated?"pixelated":""})})]}),Ul&&y.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),F||pt(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["修复 ",Ul.result.name," · 左键绘制,右键旋转"]}),y.jsx("button",{className:"button secondary",disabled:F,onClick:()=>pt(null),children:"取消 ×"})]}),y.jsxs("div",{className:"editor-content",children:[y.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[y.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?y.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):y.jsx("p",{children:"此条目暂无 edited 图片"})]}),y.jsx("div",{className:"editor-canvas-panel",children:y.jsx(X.Suspense,{fallback:y.jsx("p",{children:"正在加载皮肤编辑器…"}),children:y.jsx(_y,{textureUrl:Ul.url,busy:F,onError:b=>V(b,!0),onSubmit:b=>Tt("repair",Ul.result,b)})})})]}),Dl?.error&&y.jsx("p",{role:"alert",children:Dl.message})]}),bl&&y.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),La()},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["皮肤分类 · ",bl.id," · ",bl.model==="slim"?"纤细手臂":"标准手臂"]}),y.jsx("button",{className:"button secondary",disabled:F,onClick:La,children:"关闭 ×"})]}),y.jsx(X.Suspense,{fallback:y.jsx("p",{children:"正在加载分类标注器…"}),children:y.jsx(Ay,{data:bl,busy:F,onSave:Zt,onDirty:j},bl.key)}),Dl?.error&&y.jsx("p",{role:"alert",children:Dl.message})]})]})}gy.createRoot(document.getElementById("root")).render(y.jsx(Dy,{}));export{Uy as M,Ny as R,Of as a,ry as b,cy as g,y as j,X as r}; diff --git a/best_annotator/static/assets/index-FsJherd9.js b/best_annotator/static/assets/index-FsJherd9.js new file mode 100644 index 0000000000000000000000000000000000000000..fca39beeb1b6df7d17c927b5c5037c59251c2f13 --- /dev/null +++ b/best_annotator/static/assets/index-FsJherd9.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkinEditor-CHK_whzc.js","assets/OrbitControls-DWROePHL.js","assets/SkinEditor-BzPsKcct.css","assets/MeatEditor-DKH6Jdjh.js"])))=>i.map(i=>d[i]); +(function(){const N=document.createElement("link").relList;if(N&&N.supports&&N.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))v(D);new MutationObserver(D=>{for(const L of D)if(L.type==="childList")for(const $ of L.addedNodes)$.tagName==="LINK"&&$.rel==="modulepreload"&&v($)}).observe(document,{childList:!0,subtree:!0});function M(D){const L={};return D.integrity&&(L.integrity=D.integrity),D.referrerPolicy&&(L.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?L.credentials="include":D.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function v(D){if(D.ep)return;D.ep=!0;const L=M(D);fetch(D.href,L)}})();const ny="modulepreload",iy=function(o){return"/"+o},Ar={},Yr=function(N,M,v){let D=Promise.resolve();if(M&&M.length>0){let U=function(T){return Promise.all(T.map(Q=>Promise.resolve(Q).then(R=>({status:"fulfilled",value:R}),R=>({status:"rejected",reason:R}))))};document.getElementsByTagName("link");const $=document.querySelector("meta[property=csp-nonce]"),nl=$?.nonce||$?.getAttribute("nonce");D=U(M.map(T=>{if(T=iy(T),T in Ar)return;Ar[T]=!0;const Q=T.endsWith(".css"),R=Q?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${R}`))return;const B=document.createElement("link");if(B.rel=Q?"stylesheet":ny,Q||(B.as="script"),B.crossOrigin="",B.href=T,nl&&B.setAttribute("nonce",nl),document.head.appendChild(B),Q)return new Promise((fl,Al)=>{B.addEventListener("load",fl),B.addEventListener("error",()=>Al(new Error(`Unable to preload CSS for ${T}`)))})}))}function L($){const nl=new Event("vite:preloadError",{cancelable:!0});if(nl.payload=$,window.dispatchEvent(nl),!nl.defaultPrevented)throw $}return D.then($=>{for(const nl of $||[])nl.status==="rejected"&&L(nl.reason);return N().catch(L)})};function cy(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ef={exports:{}},Gu={};var Or;function fy(){if(Or)return Gu;Or=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.fragment");function M(v,D,L){var $=null;if(L!==void 0&&($=""+L),D.key!==void 0&&($=""+D.key),"key"in D){L={};for(var nl in D)nl!=="key"&&(L[nl]=D[nl])}else L=D;return D=L.ref,{$$typeof:o,type:v,key:$,ref:D!==void 0?D:null,props:L}}return Gu.Fragment=N,Gu.jsx=M,Gu.jsxs=M,Gu}var Mr;function sy(){return Mr||(Mr=1,Ef.exports=fy()),Ef.exports}var y=sy(),zf={exports:{}},w={};var jr;function dy(){if(jr)return w;jr=1;var o=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),$=Symbol.for("react.context"),nl=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.iterator;function fl(d){return d===null||typeof d!="object"?null:(d=B&&d[B]||d["@@iterator"],typeof d=="function"?d:null)}var Al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rl=Object.assign,F={};function zl(d,m,O){this.props=d,this.context=m,this.refs=F,this.updater=O||Al}zl.prototype.isReactComponent={},zl.prototype.setState=function(d,m){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,m,"setState")},zl.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Dl(){}Dl.prototype=zl.prototype;function ql(d,m,O){this.props=d,this.context=m,this.refs=F,this.updater=O||Al}var Ol=ql.prototype=new Dl;Ol.constructor=ql,Rl(Ol,zl.prototype),Ol.isPureReactComponent=!0;var Sl=Array.isArray;function rl(){}var I={H:null,A:null,T:null,S:null},Nl=Object.prototype.hasOwnProperty;function at(d,m,O){var x=O.ref;return{$$typeof:o,type:d,key:m,ref:x!==void 0?x:null,props:O}}function Pl(d,m){return at(d.type,m,d.props)}function wl(d){return typeof d=="object"&&d!==null&&d.$$typeof===o}function Ul(d){var m={"=":"=0",":":"=2"};return"$"+d.replace(/[=:]/g,function(O){return m[O]})}var pt=/\/+/g;function bl(d,m){return typeof d=="object"&&d!==null&&d.key!=null?Ul(""+d.key):m.toString(36)}function tt(d){switch(d.status){case"fulfilled":return d.value;case"rejected":throw d.reason;default:switch(typeof d.status=="string"?d.then(rl,rl):(d.status="pending",d.then(function(m){d.status==="pending"&&(d.status="fulfilled",d.value=m)},function(m){d.status==="pending"&&(d.status="rejected",d.reason=m)})),d.status){case"fulfilled":return d.value;case"rejected":throw d.reason}}throw d}function p(d,m,O,x,J){var V=typeof d;(V==="undefined"||V==="boolean")&&(d=null);var P=!1;if(d===null)P=!0;else switch(V){case"bigint":case"string":case"number":P=!0;break;case"object":switch(d.$$typeof){case o:case N:P=!0;break;case Q:return P=d._init,p(P(d._payload),m,O,x,J)}}if(P)return J=J(d),P=x===""?"."+bl(d,0):x,Sl(J)?(O="",P!=null&&(O=P.replace(pt,"$&/")+"/"),p(J,m,O,"",function(fe){return fe})):J!=null&&(wl(J)&&(J=Pl(J,O+(J.key==null||d&&d.key===J.key?"":(""+J.key).replace(pt,"$&/")+"/")+P)),m.push(J)),1;P=0;var Gl=x===""?".":x+":";if(Sl(d))for(var pl=0;pl>>1,ol=p[sl];if(0>>1;slD(O,C))xD(J,O)?(p[sl]=J,p[x]=C,sl=x):(p[sl]=O,p[m]=C,sl=m);else if(xD(J,C))p[sl]=J,p[x]=C,sl=x;else break l}}return j}function D(p,j){var C=p.sortIndex-j.sortIndex;return C!==0?C:p.id-j.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var L=performance;o.unstable_now=function(){return L.now()}}else{var $=Date,nl=$.now();o.unstable_now=function(){return $.now()-nl}}var U=[],T=[],Q=1,R=null,B=3,fl=!1,Al=!1,Rl=!1,F=!1,zl=typeof setTimeout=="function"?setTimeout:null,Dl=typeof clearTimeout=="function"?clearTimeout:null,ql=typeof setImmediate<"u"?setImmediate:null;function Ol(p){for(var j=M(T);j!==null;){if(j.callback===null)v(T);else if(j.startTime<=p)v(T),j.sortIndex=j.expirationTime,N(U,j);else break;j=M(T)}}function Sl(p){if(Rl=!1,Ol(p),!Al)if(M(U)!==null)Al=!0,rl||(rl=!0,Ul());else{var j=M(T);j!==null&&tt(Sl,j.startTime-p)}}var rl=!1,I=-1,Nl=5,at=-1;function Pl(){return F?!0:!(o.unstable_now()-atp&&Pl());){var sl=R.callback;if(typeof sl=="function"){R.callback=null,B=R.priorityLevel;var ol=sl(R.expirationTime<=p);if(p=o.unstable_now(),typeof ol=="function"){R.callback=ol,Ol(p),j=!0;break t}R===M(U)&&v(U),Ol(p)}else v(U);R=M(U)}if(R!==null)j=!0;else{var d=M(T);d!==null&&tt(Sl,d.startTime-p),j=!1}}break l}finally{R=null,B=C,fl=!1}j=void 0}}finally{j?Ul():rl=!1}}}var Ul;if(typeof ql=="function")Ul=function(){ql(wl)};else if(typeof MessageChannel<"u"){var pt=new MessageChannel,bl=pt.port2;pt.port1.onmessage=wl,Ul=function(){bl.postMessage(null)}}else Ul=function(){zl(wl,0)};function tt(p,j){I=zl(function(){p(o.unstable_now())},j)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(p){p.callback=null},o.unstable_forceFrameRate=function(p){0>p||125sl?(p.sortIndex=C,N(T,p),M(U)===null&&p===M(T)&&(Rl?(Dl(I),I=-1):Rl=!0,tt(Sl,C-sl))):(p.sortIndex=ol,N(U,p),Al||fl||(Al=!0,rl||(rl=!0,Ul()))),p},o.unstable_shouldYield=Pl,o.unstable_wrapCallback=function(p){var j=B;return function(){var C=B;B=j;try{return p.apply(this,arguments)}finally{B=C}}}})(_f)),_f}var Ur;function ry(){return Ur||(Ur=1,Tf.exports=oy()),Tf.exports}var Af={exports:{}},lt={};var Cr;function my(){if(Cr)return lt;Cr=1;var o=Of();function N(U){var T="https://react.dev/errors/"+U;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),Af.exports=my(),Af.exports}var Hr;function yy(){if(Hr)return Xu;Hr=1;var o=ry(),N=Of(),M=vy();function v(l){var t="https://react.dev/errors/"+l;if(1ol||(l.current=sl[ol],sl[ol]=null,ol--)}function O(l,t){ol++,sl[ol]=l.current,l.current=t}var x=d(null),J=d(null),V=d(null),P=d(null);function Gl(l,t){switch(O(V,t),O(J,l),O(x,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?$o(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=$o(t),l=Wo(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}m(x),O(x,l)}function pl(){m(x),m(J),m(V)}function fe(l){l.memoizedState!==null&&O(P,l);var t=x.current,e=Wo(t,l.type);t!==e&&(O(J,l),O(x,e))}function Tt(l){J.current===l&&(m(x),m(J)),P.current===l&&(m(P),Ru._currentValue=C)}var la,La;function Zt(l){if(la===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);la=t&&t[1]||"",La=-1)":-1u||f[a]!==g[u]){var z=` +`+f[a].replace(" at new "," at ");return l.displayName&&z.includes("")&&(z=z.replace("",l.displayName)),z}while(1<=a&&0<=u);break}}}finally{ta=!1,Error.prepareStackTrace=e}return(e=l?l.displayName||l.name:"")?Zt(e):""}function Vt(l,t){switch(l.tag){case 26:case 27:case 5:return Zt(l.type);case 16:return Zt("Lazy");case 13:return l.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return ea(l.type,!1);case 11:return ea(l.type.render,!1);case 1:return ea(l.type,!0);case 31:return Zt("Activity");default:return""}}function aa(l){try{var t="",e=null;do t+=Vt(l,e),e=l,l=l.return;while(l);return t}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var ua=Object.prototype.hasOwnProperty,Ka=o.unstable_scheduleCallback,Ja=o.unstable_cancelCallback,b=o.unstable_shouldYield,q=o.unstable_requestPaint,K=o.unstable_now,ot=o.unstable_getCurrentPriorityLevel,Cl=o.unstable_ImmediatePriority,Ht=o.unstable_UserBlockingPriority,rt=o.unstable_NormalPriority,Mf=o.unstable_LowPriority,na=o.unstable_IdlePriority,se=o.log,Zr=o.unstable_setDisableYieldValue,wa=null,mt=null;function de(l){if(typeof se=="function"&&Zr(l),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(wa,l)}catch{}}var vt=Math.clz32?Math.clz32:Kr,Vr=Math.log,Lr=Math.LN2;function Kr(l){return l>>>=0,l===0?32:31-(Vr(l)/Lr|0)|0}var Zu=256,Vu=262144,Lu=4194304;function qe(l){var t=l&42;if(t!==0)return t;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ku(l,t,e){var a=l.pendingLanes;if(a===0)return 0;var u=0,n=l.suspendedLanes,i=l.pingedLanes;l=l.warmLanes;var c=a&134217727;return c!==0?(a=c&~n,a!==0?u=qe(a):(i&=c,i!==0?u=qe(i):e||(e=c&~l,e!==0&&(u=qe(e))))):(c=a&~n,c!==0?u=qe(c):i!==0?u=qe(i):e||(e=a&~l,e!==0&&(u=qe(e)))),u===0?0:t!==0&&t!==u&&(t&n)===0&&(n=u&-u,e=t&-t,n>=e||n===32&&(e&4194048)!==0)?t:u}function $a(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Jr(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jf(){var l=Lu;return Lu<<=1,(Lu&62914560)===0&&(Lu=4194304),l}function ci(l){for(var t=[],e=0;31>e;e++)t.push(l);return t}function Wa(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function wr(l,t,e,a,u,n){var i=l.pendingLanes;l.pendingLanes=e,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=e,l.entangledLanes&=e,l.errorRecoveryDisabledLanes&=e,l.shellSuspendCounter=0;var c=l.entanglements,f=l.expirationTimes,g=l.hiddenUpdates;for(e=i&~e;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pr=/[\n"\\]/g;function At(l){return l.replace(Pr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mi(l,t,e,a,u,n,i,c){l.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.type=i:l.removeAttribute("type"),t!=null?i==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+_t(t)):l.value!==""+_t(t)&&(l.value=""+_t(t)):i!=="submit"&&i!=="reset"||l.removeAttribute("value"),t!=null?vi(l,i,_t(t)):e!=null?vi(l,i,_t(e)):a!=null&&l.removeAttribute("value"),u==null&&n!=null&&(l.defaultChecked=!!n),u!=null&&(l.checked=u&&typeof u!="function"&&typeof u!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.name=""+_t(c):l.removeAttribute("name")}function Qf(l,t,e,a,u,n,i,c){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(l.type=n),t!=null||e!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){ri(l);return}e=e!=null?""+_t(e):"",t=t!=null?""+_t(t):e,c||t===l.value||(l.value=t),l.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,l.checked=c?l.checked:!!a,l.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(l.name=i),ri(l)}function vi(l,t,e){t==="number"&&$u(l.ownerDocument)===l||l.defaultValue===""+e||(l.defaultValue=""+e)}function oa(l,t,e,a){if(l=l.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bi=!1;if(Jt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bi=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bi=!1}var re=null,Ei=null,ku=null;function $f(){if(ku)return ku;var l,t=Ei,e=t.length,a,u="value"in re?re.value:re.textContent,n=u.length;for(l=0;l=eu),ls=" ",ts=!1;function es(l,t){switch(l){case"keyup":return Mm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function as(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ya=!1;function Dm(l,t){switch(l){case"compositionend":return as(t);case"keypress":return t.which!==32?null:(ts=!0,ls);case"textInput":return l=t.data,l===ls&&ts?null:l;default:return null}}function Nm(l,t){if(ya)return l==="compositionend"||!Ai&&es(l,t)?(l=$f(),ku=Ei=re=null,ya=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:e,offset:t-l};l=a}l:{for(;e;){if(e.nextSibling){e=e.nextSibling;break l}e=e.parentNode}e=void 0}e=os(e)}}function ms(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?ms(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function vs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=$u(l.document);t instanceof l.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)l=t.contentWindow;else break;t=$u(l.document)}return t}function ji(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Ym=Jt&&"documentMode"in document&&11>=document.documentMode,ha=null,Di=null,iu=null,Ni=!1;function ys(l,t,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ni||ha==null||ha!==$u(a)||(a=ha,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),iu&&nu(iu,a)||(iu=a,a=Ln(Di,"onSelect"),0>=i,u-=i,Yt=1<<32-vt(t)+u|e<k?(al=Y,Y=null):al=Y.sibling;var cl=S(r,Y,h[k],_);if(cl===null){Y===null&&(Y=al);break}l&&Y&&cl.alternate===null&&t(r,Y),s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl,Y=al}if(k===h.length)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;kk?(al=Y,Y=null):al=Y.sibling;var He=S(r,Y,cl.value,_);if(He===null){Y===null&&(Y=al);break}l&&Y&&He.alternate===null&&t(r,Y),s=n(He,s,k),il===null?G=He:il.sibling=He,il=He,Y=al}if(cl.done)return e(r,Y),ul&&$t(r,k),G;if(Y===null){for(;!cl.done;k++,cl=h.next())cl=A(r,cl.value,_),cl!==null&&(s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl);return ul&&$t(r,k),G}for(Y=a(Y);!cl.done;k++,cl=h.next())cl=E(Y,r,k,cl.value,_),cl!==null&&(l&&cl.alternate!==null&&Y.delete(cl.key===null?k:cl.key),s=n(cl,s,k),il===null?G=cl:il.sibling=cl,il=cl);return l&&Y.forEach(function(uy){return t(r,uy)}),ul&&$t(r,k),G}function gl(r,s,h,_){if(typeof h=="object"&&h!==null&&h.type===Rl&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case fl:l:{for(var G=h.key;s!==null;){if(s.key===G){if(G=h.type,G===Rl){if(s.tag===7){e(r,s.sibling),_=u(s,h.props.children),_.return=r,r=_;break l}}else if(s.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Nl&&we(G)===s.type){e(r,s.sibling),_=u(s,h.props),ru(_,h),_.return=r,r=_;break l}e(r,s);break}else t(r,s);s=s.sibling}h.type===Rl?(_=Ze(h.props.children,r.mode,_,h.key),_.return=r,r=_):(_=cn(h.type,h.key,h.props,null,r.mode,_),ru(_,h),_.return=r,r=_)}return i(r);case Al:l:{for(G=h.key;s!==null;){if(s.key===G)if(s.tag===4&&s.stateNode.containerInfo===h.containerInfo&&s.stateNode.implementation===h.implementation){e(r,s.sibling),_=u(s,h.children||[]),_.return=r,r=_;break l}else{e(r,s);break}else t(r,s);s=s.sibling}_=Bi(h,r.mode,_),_.return=r,r=_}return i(r);case Nl:return h=we(h),gl(r,s,h,_)}if(tt(h))return H(r,s,h,_);if(Ul(h)){if(G=Ul(h),typeof G!="function")throw Error(v(150));return h=G.call(h),Z(r,s,h,_)}if(typeof h.then=="function")return gl(r,s,vn(h),_);if(h.$$typeof===ql)return gl(r,s,dn(r,h),_);yn(r,h)}return typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint"?(h=""+h,s!==null&&s.tag===6?(e(r,s.sibling),_=u(s,h),_.return=r,r=_):(e(r,s),_=qi(h,r.mode,_),_.return=r,r=_),i(r)):e(r,s)}return function(r,s,h,_){try{ou=0;var G=gl(r,s,h,_);return Ma=null,G}catch(Y){if(Y===Oa||Y===rn)throw Y;var il=ht(29,Y,null,r.mode);return il.lanes=_,il.return=r,il}}}var We=Ys(!0),Gs=Ys(!1),ge=!1;function Wi(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Se(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function be(l,t,e){var a=l.updateQueue;if(a===null)return null;if(a=a.shared,(dl&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=nn(l),ps(l,null,e),t}return un(l,a,t,e),nn(l)}function mu(l,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}function Fi(l,t){var e=l.updateQueue,a=l.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var u=null,n=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};n===null?u=n=i:n=n.next=i,e=e.next}while(e!==null);n===null?u=n=t:n=n.next=t}else u=n=t;e={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:n,shared:a.shared,callbacks:a.callbacks},l.updateQueue=e;return}l=e.lastBaseUpdate,l===null?e.firstBaseUpdate=t:l.next=t,e.lastBaseUpdate=t}var Ii=!1;function vu(){if(Ii){var l=Aa;if(l!==null)throw l}}function yu(l,t,e,a){Ii=!1;var u=l.updateQueue;ge=!1;var n=u.firstBaseUpdate,i=u.lastBaseUpdate,c=u.shared.pending;if(c!==null){u.shared.pending=null;var f=c,g=f.next;f.next=null,i===null?n=g:i.next=g,i=f;var z=l.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=g:c.next=g,z.lastBaseUpdate=f))}if(n!==null){var A=u.baseState;i=0,z=g=f=null,c=n;do{var S=c.lane&-536870913,E=S!==c.lane;if(E?(el&S)===S:(a&S)===S){S!==0&&S===_a&&(Ii=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});l:{var H=l,Z=c;S=t;var gl=e;switch(Z.tag){case 1:if(H=Z.payload,typeof H=="function"){A=H.call(gl,A,S);break l}A=H;break l;case 3:H.flags=H.flags&-65537|128;case 0:if(H=Z.payload,S=typeof H=="function"?H.call(gl,A,S):H,S==null)break l;A=R({},A,S);break l;case 2:ge=!0}}S=c.callback,S!==null&&(l.flags|=64,E&&(l.flags|=8192),E=u.callbacks,E===null?u.callbacks=[S]:E.push(S))}else E={lane:S,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(g=z=E,f=A):z=z.next=E,i|=S;if(c=c.next,c===null){if(c=u.shared.pending,c===null)break;E=c,c=E.next,E.next=null,u.lastBaseUpdate=E,u.shared.pending=null}}while(!0);z===null&&(f=A),u.baseState=f,u.firstBaseUpdate=g,u.lastBaseUpdate=z,n===null&&(u.shared.lanes=0),_e|=i,l.lanes=i,l.memoizedState=A}}function Xs(l,t){if(typeof l!="function")throw Error(v(191,l));l.call(t)}function Qs(l,t){var e=l.callbacks;if(e!==null)for(l.callbacks=null,l=0;ln?n:8;var i=p.T,c={};p.T=c,gc(l,!1,t,e);try{var f=u(),g=p.S;if(g!==null&&g(c,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var z=wm(f,a);Su(l,t,z,zt(l))}else Su(l,t,a,zt(l))}catch(A){Su(l,t,{then:function(){},status:"rejected",reason:A},zt())}finally{j.p=n,i!==null&&c.types!==null&&(i.types=c.types),p.T=i}}function Pm(){}function yc(l,t,e,a){if(l.tag!==5)throw Error(v(476));var u=bd(l).queue;Sd(l,u,t,C,e===null?Pm:function(){return Ed(l),e(a)})}function bd(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:C},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:e},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function Ed(l){var t=bd(l);t.next===null&&(t=l.alternate.memoizedState),Su(l,t.next.queue,{},zt())}function hc(){return kl(Ru)}function zd(){return Yl().memoizedState}function pd(){return Yl().memoizedState}function lv(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var e=zt();l=Se(e);var a=be(t,l,e);a!==null&&(dt(a,t,e),mu(a,t,e)),t={cache:Ki()},l.payload=t;return}t=t.return}}function tv(l,t,e){var a=zt();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},An(l)?_d(t,e):(e=Hi(l,t,e,a),e!==null&&(dt(e,l,a),Ad(e,t,a)))}function Td(l,t,e){var a=zt();Su(l,t,e,a)}function Su(l,t,e,a){var u={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(An(l))_d(t,u);else{var n=l.alternate;if(l.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var i=t.lastRenderedState,c=n(i,e);if(u.hasEagerState=!0,u.eagerState=c,yt(c,i))return un(l,t,u,0),El===null&&an(),!1}catch{}if(e=Hi(l,t,u,a),e!==null)return dt(e,l,a),Ad(e,t,a),!0}return!1}function gc(l,t,e,a){if(a={lane:2,revertLane:Wc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},An(l)){if(t)throw Error(v(479))}else t=Hi(l,e,a,2),t!==null&&dt(t,l,2)}function An(l){var t=l.alternate;return l===W||t!==null&&t===W}function _d(l,t){Da=Sn=!0;var e=l.pending;e===null?t.next=t:(t.next=e.next,e.next=t),l.pending=t}function Ad(l,t,e){if((e&4194048)!==0){var a=t.lanes;a&=l.pendingLanes,e|=a,t.lanes=e,Nf(l,e)}}var bu={readContext:kl,use:zn,useCallback:xl,useContext:xl,useEffect:xl,useImperativeHandle:xl,useLayoutEffect:xl,useInsertionEffect:xl,useMemo:xl,useReducer:xl,useRef:xl,useState:xl,useDebugValue:xl,useDeferredValue:xl,useTransition:xl,useSyncExternalStore:xl,useId:xl,useHostTransitionStatus:xl,useFormState:xl,useActionState:xl,useOptimistic:xl,useMemoCache:xl,useCacheRefresh:xl};bu.useEffectEvent=xl;var Od={readContext:kl,use:zn,useCallback:function(l,t){return et().memoizedState=[l,t===void 0?null:t],l},useContext:kl,useEffect:sd,useImperativeHandle:function(l,t,e){e=e!=null?e.concat([l]):null,Tn(4194308,4,md.bind(null,t,l),e)},useLayoutEffect:function(l,t){return Tn(4194308,4,l,t)},useInsertionEffect:function(l,t){Tn(4,2,l,t)},useMemo:function(l,t){var e=et();t=t===void 0?null:t;var a=l();if(ke){de(!0);try{l()}finally{de(!1)}}return e.memoizedState=[a,t],a},useReducer:function(l,t,e){var a=et();if(e!==void 0){var u=e(t);if(ke){de(!0);try{e(t)}finally{de(!1)}}}else u=t;return a.memoizedState=a.baseState=u,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},a.queue=l,l=l.dispatch=tv.bind(null,W,l),[a.memoizedState,l]},useRef:function(l){var t=et();return l={current:l},t.memoizedState=l},useState:function(l){l=dc(l);var t=l.queue,e=Td.bind(null,W,t);return t.dispatch=e,[l.memoizedState,e]},useDebugValue:mc,useDeferredValue:function(l,t){var e=et();return vc(e,l,t)},useTransition:function(){var l=dc(!1);return l=Sd.bind(null,W,l.queue,!0,!1),et().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,e){var a=W,u=et();if(ul){if(e===void 0)throw Error(v(407));e=e()}else{if(e=t(),El===null)throw Error(v(349));(el&127)!==0||ws(a,t,e)}u.memoizedState=e;var n={value:e,getSnapshot:t};return u.queue=n,sd(Ws.bind(null,a,n,l),[l]),a.flags|=2048,Ua(9,{destroy:void 0},$s.bind(null,a,n,e,t),null),e},useId:function(){var l=et(),t=El.identifierPrefix;if(ul){var e=Gt,a=Yt;e=(a&~(1<<32-vt(a)-1)).toString(32)+e,t="_"+t+"R_"+e,e=bn++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?n.multiple=!0:a.size&&(n.size=a.size);break;default:n=typeof a.is=="string"?i.createElement(u,{is:a.is}):i.createElement(u)}}n[$l]=t,n[ut]=a;l:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break l;for(;i.sibling===null;){if(i.return===null||i.return===t)break l;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=n;l:switch(Il(n,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break l;case"img":a=!0;break l;default:a=!1}a&&le(t)}}return _l(t),Uc(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,e),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==a&&le(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(v(166));if(l=V.current,pa(t)){if(l=t.stateNode,e=t.memoizedProps,a=null,u=Wl,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}l[$l]=t,l=!!(l.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(l.nodeValue,e)),l||ye(t,!0)}else l=Kn(l).createTextNode(a),l[$l]=t,t.stateNode=l}return _l(t),null;case 31:if(e=t.memoizedState,l===null||l.memoizedState!==null){if(a=pa(t),e!==null){if(l===null){if(!a)throw Error(v(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(v(557));l[$l]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),l=!1}else e=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=e),l=!0;if(!l)return t.flags&256?(St(t),t):(St(t),null);if((t.flags&128)!==0)throw Error(v(558))}return _l(t),null;case 13:if(a=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(u=pa(t),a!==null&&a.dehydrated!==null){if(l===null){if(!u)throw Error(v(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(v(317));u[$l]=t}else Ve(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_l(t),u=!1}else u=Qi(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(St(t),t):(St(t),null)}return St(t),(t.flags&128)!==0?(t.lanes=e,t):(e=a!==null,l=l!==null&&l.memoizedState!==null,e&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==u&&(a.flags|=2048)),e!==l&&e&&(t.child.flags|=8192),Nn(t,t.updateQueue),_l(t),null);case 4:return pl(),l===null&&Pc(t.stateNode.containerInfo),_l(t),null;case 10:return kt(t.type),_l(t),null;case 19:if(m(Bl),a=t.memoizedState,a===null)return _l(t),null;if(u=(t.flags&128)!==0,n=a.rendering,n===null)if(u)zu(a,!1);else{if(Hl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(n=gn(l),n!==null){for(t.flags|=128,zu(a,!1),l=n.updateQueue,t.updateQueue=l,Nn(t,l),t.subtreeFlags=0,l=e,e=t.child;e!==null;)Ts(e,l),e=e.sibling;return O(Bl,Bl.current&1|2),ul&&$t(t,a.treeForkCount),t.child}l=l.sibling}a.tail!==null&&K()>Rn&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304)}else{if(!u)if(l=gn(n),l!==null){if(t.flags|=128,u=!0,l=l.updateQueue,t.updateQueue=l,Nn(t,l),zu(a,!0),a.tail===null&&a.tailMode==="hidden"&&!n.alternate&&!ul)return _l(t),null}else 2*K()-a.renderingStartTime>Rn&&e!==536870912&&(t.flags|=128,u=!0,zu(a,!1),t.lanes=4194304);a.isBackwards?(n.sibling=t.child,t.child=n):(l=a.last,l!==null?l.sibling=n:t.child=n,a.last=n)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=K(),l.sibling=null,e=Bl.current,O(Bl,u?e&1|2:e&1),ul&&$t(t,a.treeForkCount),l):(_l(t),null);case 22:case 23:return St(t),lc(),a=t.memoizedState!==null,l!==null?l.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(e&536870912)!==0&&(t.flags&128)===0&&(_l(t),t.subtreeFlags&6&&(t.flags|=8192)):_l(t),e=t.updateQueue,e!==null&&Nn(t,e.retryQueue),e=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==e&&(t.flags|=2048),l!==null&&m(Je),null;case 24:return e=null,l!==null&&(e=l.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),kt(Xl),_l(t),null;case 25:return null;case 30:return null}throw Error(v(156,t.tag))}function iv(l,t){switch(Gi(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return kt(Xl),pl(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return Tt(t),null;case 31:if(t.memoizedState!==null){if(St(t),t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(St(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(v(340));Ve()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return m(Bl),null;case 4:return pl(),null;case 10:return kt(t.type),null;case 22:case 23:return St(t),lc(),l!==null&&m(Je),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return kt(Xl),null;case 25:return null;default:return null}}function kd(l,t){switch(Gi(t),t.tag){case 3:kt(Xl),pl();break;case 26:case 27:case 5:Tt(t);break;case 4:pl();break;case 31:t.memoizedState!==null&&St(t);break;case 13:St(t);break;case 19:m(Bl);break;case 10:kt(t.type);break;case 22:case 23:St(t),lc(),l!==null&&m(Je);break;case 24:kt(Xl)}}function pu(l,t){try{var e=t.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var u=a.next;e=u;do{if((e.tag&l)===l){a=void 0;var n=e.create,i=e.inst;a=n(),i.destroy=a}e=e.next}while(e!==u)}}catch(c){vl(t,t.return,c)}}function pe(l,t,e){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var n=u.next;a=n;do{if((a.tag&l)===l){var i=a.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,u=t;var f=e,g=c;try{g()}catch(z){vl(u,f,z)}}}a=a.next}while(a!==n)}}catch(z){vl(t,t.return,z)}}function Fd(l){var t=l.updateQueue;if(t!==null){var e=l.stateNode;try{Qs(t,e)}catch(a){vl(l,l.return,a)}}}function Id(l,t,e){e.props=Fe(l.type,l.memoizedProps),e.state=l.memoizedState;try{e.componentWillUnmount()}catch(a){vl(l,t,a)}}function Tu(l,t){try{var e=l.ref;if(e!==null){switch(l.tag){case 26:case 27:case 5:var a=l.stateNode;break;case 30:a=l.stateNode;break;default:a=l.stateNode}typeof e=="function"?l.refCleanup=e(a):e.current=a}}catch(u){vl(l,t,u)}}function Xt(l,t){var e=l.ref,a=l.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(u){vl(l,t,u)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(u){vl(l,t,u)}else e.current=null}function Pd(l){var t=l.type,e=l.memoizedProps,a=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break l;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(u){vl(l,l.return,u)}}function Cc(l,t,e){try{var a=l.stateNode;jv(a,l.type,e,t),a[ut]=t}catch(u){vl(l,l.return,u)}}function lo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&De(l.type)||l.tag===4}function xc(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||lo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&De(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hc(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(l,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(l),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=Kt));else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode,t=null),l=l.child,l!==null))for(Hc(l,t,e),l=l.sibling;l!==null;)Hc(l,t,e),l=l.sibling}function Un(l,t,e){var a=l.tag;if(a===5||a===6)l=l.stateNode,t?e.insertBefore(l,t):e.appendChild(l);else if(a!==4&&(a===27&&De(l.type)&&(e=l.stateNode),l=l.child,l!==null))for(Un(l,t,e),l=l.sibling;l!==null;)Un(l,t,e),l=l.sibling}function to(l){var t=l.stateNode,e=l.memoizedProps;try{for(var a=l.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Il(t,a,e),t[$l]=l,t[ut]=e}catch(n){vl(l,l.return,n)}}var te=!1,Vl=!1,Rc=!1,eo=typeof WeakSet=="function"?WeakSet:Set,Jl=null;function cv(l,t){if(l=l.containerInfo,ef=In,l=vs(l),ji(l)){if("selectionStart"in l)var e={start:l.selectionStart,end:l.selectionEnd};else l:{e=(e=l.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var u=a.anchorOffset,n=a.focusNode;a=a.focusOffset;try{e.nodeType,n.nodeType}catch{e=null;break l}var i=0,c=-1,f=-1,g=0,z=0,A=l,S=null;t:for(;;){for(var E;A!==e||u!==0&&A.nodeType!==3||(c=i+u),A!==n||a!==0&&A.nodeType!==3||(f=i+a),A.nodeType===3&&(i+=A.nodeValue.length),(E=A.firstChild)!==null;)S=A,A=E;for(;;){if(A===l)break t;if(S===e&&++g===u&&(c=i),S===n&&++z===a&&(f=i),(E=A.nextSibling)!==null)break;A=S,S=A.parentNode}A=E}e=c===-1||f===-1?null:{start:c,end:f}}else e=null}e=e||{start:0,end:0}}else e=null;for(af={focusedElem:l,selectionRange:e},In=!1,Jl=t;Jl!==null;)if(t=Jl,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Jl=l;else for(;Jl!==null;){switch(t=Jl,n=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(e=0;e title"))),Il(n,a,e),n[$l]=l,Kl(n),a=n;break l;case"link":var i=sr("link","href",u).get(a+(e.href||""));if(i){for(var c=0;cgl&&(i=gl,gl=Z,Z=i);var r=rs(c,Z),s=rs(c,gl);if(r&&s&&(E.rangeCount!==1||E.anchorNode!==r.node||E.anchorOffset!==r.offset||E.focusNode!==s.node||E.focusOffset!==s.offset)){var h=A.createRange();h.setStart(r.node,r.offset),E.removeAllRanges(),Z>gl?(E.addRange(h),E.extend(s.node,s.offset)):(h.setEnd(s.node,s.offset),E.addRange(h))}}}}for(A=[],E=c;E=E.parentNode;)E.nodeType===1&&A.push({element:E,left:E.scrollLeft,top:E.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;ce?32:e,p.T=null,e=Zc,Zc=null;var n=Oe,i=ie;if(Ll=0,qa=Oe=null,ie=0,(dl&6)!==0)throw Error(v(331));var c=dl;if(dl|=4,vo(n.current),oo(n,n.current,i,e),dl=c,Du(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(wa,n)}catch{}return!0}finally{j.p=u,p.T=a,Co(l,t)}}function Ho(l,t,e){t=Mt(e,t),t=zc(l.stateNode,t,2),l=be(l,t,2),l!==null&&(Wa(l,2),Qt(l))}function vl(l,t,e){if(l.tag===3)Ho(l,l,e);else for(;t!==null;){if(t.tag===3){Ho(t,l,e);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ae===null||!Ae.has(a))){l=Mt(e,l),e=Hd(2),a=be(t,e,2),a!==null&&(Rd(e,a,t,l),Wa(a,2),Qt(a));break}}t=t.return}}function Jc(l,t,e){var a=l.pingCache;if(a===null){a=l.pingCache=new dv;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(e)||(Yc=!0,u.add(e),l=yv.bind(null,l,t,e),t.then(l,l))}function yv(l,t,e){var a=l.pingCache;a!==null&&a.delete(t),l.pingedLanes|=l.suspendedLanes&e,l.warmLanes&=~e,El===l&&(el&e)===e&&(Hl===4||Hl===3&&(el&62914560)===el&&300>K()-Hn?(dl&2)===0&&Ba(l,0):Gc|=e,Ra===el&&(Ra=0)),Qt(l)}function Ro(l,t){t===0&&(t=jf()),l=Qe(l,t),l!==null&&(Wa(l,t),Qt(l))}function hv(l){var t=l.memoizedState,e=0;t!==null&&(e=t.retryLane),Ro(l,e)}function gv(l,t){var e=0;switch(l.tag){case 31:case 13:var a=l.stateNode,u=l.memoizedState;u!==null&&(e=u.retryLane);break;case 19:a=l.stateNode;break;case 22:a=l.stateNode._retryCache;break;default:throw Error(v(314))}a!==null&&a.delete(t),Ro(l,e)}function Sv(l,t){return Ka(l,t)}var Qn=null,Ga=null,wc=!1,Zn=!1,$c=!1,je=0;function Qt(l){l!==Ga&&l.next===null&&(Ga===null?Qn=Ga=l:Ga=Ga.next=l),Zn=!0,wc||(wc=!0,Ev())}function Du(l,t){if(!$c&&Zn){$c=!0;do for(var e=!1,a=Qn;a!==null;){if(l!==0){var u=a.pendingLanes;if(u===0)var n=0;else{var i=a.suspendedLanes,c=a.pingedLanes;n=(1<<31-vt(42|l)+1)-1,n&=u&~(i&~c),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(e=!0,Go(a,n))}else n=el,n=Ku(a,a===El?n:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(n&3)===0||$a(a,n)||(e=!0,Go(a,n));a=a.next}while(e);$c=!1}}function bv(){qo()}function qo(){Zn=wc=!1;var l=0;je!==0&&Nv()&&(l=je);for(var t=K(),e=null,a=Qn;a!==null;){var u=a.next,n=Bo(a,t);n===0?(a.next=null,e===null?Qn=u:e.next=u,u===null&&(Ga=e)):(e=a,(l!==0||(n&3)!==0)&&(Zn=!0)),a=u}Ll!==0&&Ll!==5||Du(l),je!==0&&(je=0)}function Bo(l,t){for(var e=l.suspendedLanes,a=l.pingedLanes,u=l.expirationTimes,n=l.pendingLanes&-62914561;0c)break;var z=f.transferSize,A=f.initiatorType;z&&wo(A)&&(f=f.responseEnd,i+=z*(f"u"?null:document;function nr(l,t,e){var a=Xa;if(a&&typeof t=="string"&&t){var u=At(t);u='link[rel="'+l+'"][href="'+u+'"]',typeof e=="string"&&(u+='[crossorigin="'+e+'"]'),ur.has(u)||(ur.add(u),l={rel:l,crossOrigin:e,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Il(t,"link",l),Kl(t),a.head.appendChild(t)))}}function Gv(l){ce.D(l),nr("dns-prefetch",l,null)}function Xv(l,t){ce.C(l,t),nr("preconnect",l,t)}function Qv(l,t,e){ce.L(l,t,e);var a=Xa;if(a&&l&&t){var u='link[rel="preload"][as="'+At(t)+'"]';t==="image"&&e&&e.imageSrcSet?(u+='[imagesrcset="'+At(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(u+='[imagesizes="'+At(e.imageSizes)+'"]')):u+='[href="'+At(l)+'"]';var n=u;switch(t){case"style":n=Qa(l);break;case"script":n=Za(l)}xt.has(n)||(l=R({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:l,as:t},e),xt.set(n,l),a.querySelector(u)!==null||t==="style"&&a.querySelector(xu(n))||t==="script"&&a.querySelector(Hu(n))||(t=a.createElement("link"),Il(t,"link",l),Kl(t),a.head.appendChild(t)))}}function Zv(l,t){ce.m(l,t);var e=Xa;if(e&&l){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+At(a)+'"][href="'+At(l)+'"]',n=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Za(l)}if(!xt.has(n)&&(l=R({rel:"modulepreload",href:l},t),xt.set(n,l),e.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Hu(n)))return}a=e.createElement("link"),Il(a,"link",l),Kl(a),e.head.appendChild(a)}}}function Vv(l,t,e){ce.S(l,t,e);var a=Xa;if(a&&l){var u=sa(a).hoistableStyles,n=Qa(l);t=t||"default";var i=u.get(n);if(!i){var c={loading:0,preload:null};if(i=a.querySelector(xu(n)))c.loading=5;else{l=R({rel:"stylesheet",href:l,"data-precedence":t},e),(e=xt.get(n))&&of(l,e);var f=i=a.createElement("link");Kl(f),Il(f,"link",l),f._p=new Promise(function(g,z){f.onload=g,f.onerror=z}),f.addEventListener("load",function(){c.loading|=1}),f.addEventListener("error",function(){c.loading|=2}),c.loading|=4,wn(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:c},u.set(n,i)}}}function Lv(l,t){ce.X(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Kl(n),Il(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function Kv(l,t){ce.M(l,t);var e=Xa;if(e&&l){var a=sa(e).hoistableScripts,u=Za(l),n=a.get(u);n||(n=e.querySelector(Hu(u)),n||(l=R({src:l,async:!0,type:"module"},t),(t=xt.get(u))&&rf(l,t),n=e.createElement("script"),Kl(n),Il(n,"link",l),e.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},a.set(u,n))}}function ir(l,t,e,a){var u=(u=V.current)?Jn(u):null;if(!u)throw Error(v(446));switch(l){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Qa(e.href),e=sa(u).hoistableStyles,a=e.get(t),a||(a={type:"style",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){l=Qa(e.href);var n=sa(u).hoistableStyles,i=n.get(l);if(i||(u=u.ownerDocument||u,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(l,i),(n=u.querySelector(xu(l)))&&!n._p&&(i.instance=n,i.state.loading=5),xt.has(l)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},xt.set(l,e),n||Jv(u,l,e,i.state))),t&&a===null)throw Error(v(528,""));return i}if(t&&a!==null)throw Error(v(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Za(e),e=sa(u).hoistableScripts,a=e.get(t),a||(a={type:"script",instance:null,count:0,state:null},e.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(v(444,l))}}function Qa(l){return'href="'+At(l)+'"'}function xu(l){return'link[rel="stylesheet"]['+l+"]"}function cr(l){return R({},l,{"data-precedence":l.precedence,precedence:null})}function Jv(l,t,e,a){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=l.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Il(t,"link",e),Kl(t),l.head.appendChild(t))}function Za(l){return'[src="'+At(l)+'"]'}function Hu(l){return"script[async]"+l}function fr(l,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var a=l.querySelector('style[data-href~="'+At(e.href)+'"]');if(a)return t.instance=a,Kl(a),a;var u=R({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(l.ownerDocument||l).createElement("style"),Kl(a),Il(a,"style",u),wn(a,e.precedence,l),t.instance=a;case"stylesheet":u=Qa(e.href);var n=l.querySelector(xu(u));if(n)return t.state.loading|=4,t.instance=n,Kl(n),n;a=cr(e),(u=xt.get(u))&&of(a,u),n=(l.ownerDocument||l).createElement("link"),Kl(n);var i=n;return i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Il(n,"link",a),t.state.loading|=4,wn(n,e.precedence,l),t.instance=n;case"script":return n=Za(e.src),(u=l.querySelector(Hu(n)))?(t.instance=u,Kl(u),u):(a=e,(u=xt.get(n))&&(a=R({},e),rf(a,u)),l=l.ownerDocument||l,u=l.createElement("script"),Kl(u),Il(u,"link",a),l.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(v(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wn(a,e.precedence,l));return t.instance}function wn(l,t,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,n=u,i=0;i title"):null)}function wv(l,t,e){if(e===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(l=t.disabled,typeof t.precedence=="string"&&l==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function or(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function $v(l,t,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var u=Qa(a.href),n=t.querySelector(xu(u));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Wn.bind(l),t.then(l,l)),e.state.loading|=4,e.instance=n,Kl(n);return}n=t.ownerDocument||t,a=cr(a),(u=xt.get(u))&&of(a,u),n=n.createElement("link"),Kl(n);var i=n;i._p=new Promise(function(c,f){i.onload=c,i.onerror=f}),Il(n,"link",a),e.instance=n}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(l.count++,e=Wn.bind(l),t.addEventListener("load",e),t.addEventListener("error",e))}}var mf=0;function Wv(l,t){return l.stylesheets&&l.count===0&&Fn(l,l.stylesheets),0mf?50:800)+t);return l.unsuspend=e,function(){l.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Wn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fn(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var kn=null;function Fn(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,kn=new Map,t.forEach(kv,l),kn=null,Wn.call(l))}function kv(l,t){if(!(t.state.loading&4)){var e=kn.get(l);if(e)var a=e.get(null);else{e=new Map,kn.set(l,e);for(var u=l.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(N){console.error(N)}}return o(),pf.exports=yy(),pf.exports}var gy=hy();const jl={viewers:[],camera:"angle",syncing:!1,outerLayer:!0,uvOnly:!1,generation:0};function Sy(o){const N=o.camera;if(jl.camera==="head")o.controls.target.set(0,10,0),N.position.set(10,12,18);else{o.controls.target.set(0,0,0);const M=48;jl.camera==="front"?N.position.set(0,0,M):jl.camera==="back"?N.position.set(0,0,-M):N.position.set(23,7,42)}N.lookAt(o.controls.target),N.updateProjectionMatrix(),o.controls.update()}function Gr(){jl.syncing=!0;try{jl.viewers.forEach(o=>Sy(o.viewer))}finally{jl.syncing=!1}document.querySelectorAll("[data-camera]").forEach(o=>o.classList.toggle("active",o.dataset.camera===jl.camera))}function by(o){if(!jl.syncing){jl.syncing=!0;try{for(const{viewer:N}of jl.viewers)N!==o&&(N.camera.position.copy(o.camera.position),N.camera.quaternion.copy(o.camera.quaternion),N.camera.zoom=o.camera.zoom,N.controls.target.copy(o.controls.target),N.camera.updateProjectionMatrix(),N.controls.update())}finally{jl.syncing=!1}}}function Ey(o,N,M){const v=o.querySelector(".preview-status");if(!window.skinview3d){v.textContent="3D 组件不可用,请查看下方 UV";return}let D;try{D=new skinview3d.SkinViewer({canvas:o.querySelector("canvas"),width:o.clientWidth||220,height:o.clientHeight||300,pixelRatio:Math.min(window.devicePixelRatio||1,2),renderPaused:jl.uvOnly,model:"default"}),D.controls.enablePan=!1,D.controls.enableDamping=!1,D.controls.minDistance=12,D.controls.maxDistance=120,D.controls.addEventListener("change",()=>by(D));const L=new ResizeObserver(()=>{!D.disposed&&o.clientWidth&&o.clientHeight&&(D.width=o.clientWidth,D.height=o.clientHeight)});L.observe(o),jl.viewers.push({viewer:D,observer:L}),Promise.resolve(D.loadSkin(N.url,{model:"default"})).then(()=>{M!==jl.generation||D.disposed||(D.playerObject.skin.setOuterLayerVisible(jl.outerLayer),v.hidden=!0)}).catch(()=>{M===jl.generation&&(v.textContent="此图片无法生成 3D 预览,可查看 UV")})}catch{D&&!D.disposed&&D.dispose(),v.textContent="3D 预览不可用,可查看下方 UV"}}function zy(o,N){Ey(o,N,jl.generation),Gr();const M=jl.viewers.find(v=>v.viewer.canvas===o.querySelector("canvas"))||jl.viewers.at(-1);return()=>{M&&(M.observer.disconnect(),M.viewer.dispose(),M.viewer.renderer.forceContextLoss(),jl.viewers=jl.viewers.filter(v=>v!==M))}}function py(o,N,M){const v=jl.camera!==o;Object.assign(jl,{camera:o,outerLayer:N,uvOnly:M}),v&&Gr(),jl.viewers.forEach(({viewer:D})=>{D.playerObject.skin.setOuterLayerVisible(N),D.renderPaused=M})}async function Qu(o,N,M){const v=await fetch("/api/meat-model/"+o,N===void 0?{signal:M}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N),signal:M}),D=await v.json();if(!v.ok)throw Error(D.error||"预选服务暂不可用");return D}const Xr=o=>["complete","failed"].includes(o);function Qr(o){const N={queued:"等待启动",validating:"检查人工标签",waiting_gpu:"等待特征提取",features:"提取多视角特征",face_features:"补齐六面特征",training:"训练与交叉验证",verifying:"核验并更新模型",predicting:"正在识别五类标注",complete:"已完成",failed:"失败"},M=o?.progress;return(N[o?.stage]||"正在预选")+(M?.fold?` · ${{local:"局部特征",all_faces:"六面特征",surface:"表面结构模型",surface_control:"旧结构对照",face_v8:"面部解码器"}[M.variant]||"DINO+局部特征"} ${M.fold}/${M.total} 组`:M?.remaining?` · 剩余 ${M.remaining} 张`:M?.stage==="final_fit"?" · 拟合最终模型":"")}function Ty(){const[o,N]=X.useState(null),[M,v]=X.useState(""),[D,L]=X.useState(!1),$=X.useRef(!0),nl=X.useRef(null),U=X.useRef(!1),T=async()=>{try{const B=await Qu("status");$.current&&(N(B),v(""))}catch(B){$.current&&v(B.message)}};X.useEffect(()=>{$.current=!0,T();const B=()=>T();return window.addEventListener("meat-saved",B),nl.current=setInterval(T,1e4),()=>{$.current=!1,clearInterval(nl.current),window.removeEventListener("meat-saved",B)}},[]);const Q=o?.training&&!Xr(o.training.stage),R=async()=>{if(!U.current){U.current=!0,L(!0),v("");try{const B=await Qu("train",{});$.current&&N(fl=>({...fl,training:B}))}catch(B){$.current&&v(B.message)}finally{U.current=!1,$.current&&(L(!1),T())}}};return y.jsxs("section",{className:"meat-model-panel","aria-label":"Meat 预选模型",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Meat 预选模型"}),y.jsx("span",{children:o?.active?` ${o.active.id} · 已学习 ${o.active.count} 张`:" 正在连接 ds…"}),y.jsx("p",{children:"预选包含裸露皮肤、眼睛、嘴巴、眉毛和胡子。仅在点击训练按钮时更新模型;保存标注不会自动训练。已保存的细分类参与训练,未细标格仍用于二分类。"}),o?.dataset&&y.jsxs("p",{children:["当前可训练 ",o.dataset.count," 张 · 已细标 ",o.dataset.semantic_cases||0," 张 / ",o.dataset.semantic_cells||0," 格 · 新增或修改 ",o.dataset.changed," 张",o.dataset.removed>0?` · 移除或失效 ${o.dataset.removed} 张`:""]})]}),y.jsxs("div",{className:"meat-model-actions",children:[y.jsx("button",{className:"button",onClick:R,disabled:D||Q||!o?.active||o?.dataset?.count<3,children:D?"正在启动…":Q?"训练进行中…":"训练并更新预选模型"}),y.jsx("button",{className:"button secondary",onClick:T,children:"刷新模型状态"})]}),o?.training&&y.jsxs("p",{role:"status",children:[Qr(o.training),o.training.stage==="complete"?o.training.promoted===!1?" · 候选已完成,尚未替换当前模型":" · 新模型已启用":"",o.training.error?`:${o.training.error}。原模型保持可用。`:""]}),o?.active?.metrics&&y.jsxs("small",{children:["历史皮肤分组验证 · meat 二分类 IoU ",(o.active.metrics.iou*100).toFixed(1),"%;这不是五类准确率或新皮肤准确率,预选仍需人工检查。"]}),o?.active?.fine_metrics&&y.jsxs("p",{children:["已知细标的留出召回:",Object.entries({1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"}).map(([B,fl])=>`${fl} ${((o.active.fine_metrics[B]?.recall||0)*100).toFixed(1)}%`).join(" · "),"。细标含人工与助手来源。"]}),!!o?.dataset?.excluded?.length&&y.jsxs("details",{children:[y.jsxs("summary",{children:[o.dataset.excluded.length," 张未纳入本轮训练"]}),o.dataset.excluded.map((B,fl)=>y.jsxs("p",{children:[B.id,":",B.reason]},fl))]}),M&&y.jsx("p",{className:"meat-warning",role:"alert",children:M})]})}function Uy({data:o,disabled:N,onStart:M,onEnd:v,onApply:D,hint:L}){const[$,nl]=X.useState("precision"),[U,T]=X.useState(!1);X.useEffect(()=>{let Ol=!0;return Qu("status").then(Sl=>{Ol&&T(Sl.active?.architecture==="face_v8")}).catch(()=>{}),()=>{Ol=!1}},[]);const[Q,R]=X.useState(!1),[B,fl]=X.useState(""),[Al,Rl]=X.useState(""),F=X.useRef(!0),zl=X.useRef(null),Dl=X.useRef(!1);X.useEffect(()=>(F.current=!0,()=>{F.current=!1,zl.current?.abort()}),[]);const ql=async()=>{if(Dl.current)return;Dl.current=!0,R(!0),Rl(""),fl("正在请求预选…"),M(),zl.current=new AbortController;const Ol=zl.current.signal;try{let Sl=await Qu("predict",{key:o.key,skin_revision:o.skin_revision,preselection_policy:$},Ol);for(;!Xr(Sl.stage);){if(!F.current||(fl(Qr(Sl)),await new Promise(rl=>setTimeout(rl,1500)),!F.current))return;Sl=await Qu("job?id="+encodeURIComponent(Sl.id),void 0,Ol)}if(Sl.stage==="failed")throw Error(Sl.error||"预选失败,请稍后重试");if(Sl.prediction.skin_revision!==o.skin_revision)throw Error("皮肤版本已变化,未应用预选");if(F.current){D(Sl.prediction);const rl=Sl.prediction,I={1:"裸露皮肤",2:"眼睛",3:"嘴巴",5:"眉毛",6:"胡子"},Nl=rl.semantic_available?Object.entries(I).map(([at,Pl])=>`${Pl} ${rl.category_counts?.[at]||0} 格`).join(" · "):`${rl.selected.length} 格 meat(当前旧模型仅支持二分类,已有细分类保留)`;fl(`预选来自 ${rl.model_id}${rl.preselection_policy?` · ${rl.preselection_policy==="precision"?"优先减少误选":"均衡召回"}`:""} · ${Nl}${rl.uncertain_count?` · ${rl.uncertain_count} 格不确定,已保持未选,请复核`:""}。切换类别查看高亮;请检查并修改,再保存。`)}}catch(Sl){F.current&&Sl.name!=="AbortError"&&(Rl(Sl.message),fl(""))}finally{Dl.current=!1,F.current&&(R(!1),v())}};return y.jsxs("div",{className:"meat-preselect",children:[y.jsx("button",{className:"button secondary",onClick:ql,disabled:N||Q||o.model!=="classic",children:Q?"五类预选中…":"模型预选五类"}),y.jsxs("label",{children:["预选方式 ",y.jsxs("select",{"aria-label":"预选方式",value:$,disabled:N||Q||!U,onChange:Ol=>nl(Ol.target.value),children:[y.jsx("option",{value:"precision",children:"优先减少误选"}),y.jsx("option",{value:"balanced",children:"均衡召回"})]})]}),!U&&y.jsx("small",{children:"当前模型不支持切换预选方式;启用面部模型后可用。"}),y.jsx("span",{children:o.model!=="classic"?"当前模型暂不支持纤细手臂,请人工标注。":L||"替换当前选区,可撤销;只有点击保存才写入人工标签。"}),B&&y.jsx("p",{role:"status",children:B}),Al&&y.jsx("p",{role:"alert",className:"meat-warning",children:Al})]})}const _y=X.lazy(()=>Yr(()=>import("./SkinEditor-CHK_whzc.js"),__vite__mapDeps([0,1,2])).then(o=>({default:o.SkinEditor}))),Ay=X.lazy(()=>Yr(()=>import("./MeatEditor-DKH6Jdjh.js"),__vite__mapDeps([3,1]))),Re=o=>!!(o.best||o.rejection),ni=o=>o.model??o.folder,qr=o=>o==="edited_unsatisfied"?"edited 不满意":"结果都不满意",Oy={all:"全部已标注",perfect:"有完美标注",meat_pending:"Perfect · 待标 meat",meat_saved:"Perfect · 已标 meat",best:"有最佳标注(含完美)",ordinary:"仅最佳标注(无完美)",result_unsatisfied:"结果都不满意",edited_unsatisfied:"edited 不满意"},My=(o,N)=>N==="all"||N==="perfect"&&!!o.perfect||N==="meat_pending"&&!!o.perfect&&o.meat_status!=="saved"||N==="meat_saved"&&!!o.perfect&&o.meat_status==="saved"||N==="best"&&!!o.best||N==="ordinary"&&!!o.best&&!o.perfect||o.rejection===N,Br=o=>o.version==="original"?"原版":o.version;async function ii(o,N){const M=await fetch(o,N===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json","X-Annotation-Client":"ddj-review"},body:JSON.stringify(N)}),v=await M.json();if(!M.ok)throw Error(v.error||"请求失败");return v}function jy({result:o}){const N=X.useRef(null);return X.useEffect(()=>zy(N.current,o),[o.url]),y.jsxs("div",{className:"skin-stage",ref:N,children:[y.jsx("canvas",{}),y.jsx("span",{className:"preview-status",children:"正在加载 3D…"})]})}function Dy(){const[o,N]=X.useState([]),[M,v]=X.useState(null),[D,L]=X.useState("pending"),[$,nl]=X.useState("all"),[U,T]=X.useState(""),[Q,R]=X.useState(""),[B,fl]=X.useState(new Set),[Al,Rl]=X.useState([]),[F,zl]=X.useState(!1),[Dl,ql]=X.useState(null),[Ol,Sl]=X.useState("angle"),[rl,I]=X.useState(!0),[Nl,at]=X.useState(!1),[Pl,wl]=X.useState(null),[Ul,pt]=X.useState(null),[bl,tt]=X.useState(null),[p,j]=X.useState(!1),C=X.useRef(!1),sl=X.useRef(null),ol=X.useRef(null),d=X.useRef(null),m=o.find(b=>b.key===M),O=(b,q=D,K=U,ot=Q,Cl=$)=>(!K||ni(b)===K)&&b.id.toLowerCase().includes(ot.trim().toLowerCase())&&(q==="all"||q==="pending"&&b.results.length>0&&!Re(b)||q==="done"&&Re(b)&&My(b,Cl)||q==="rejected"&&!!b.rejection||q==="no_results"&&!b.results.length),x=o.filter(b=>O(b)),J=m&&!x.includes(m)?[m,...x]:x,V=(b,q=!1)=>ql({message:b,error:q}),P=(b,q=!0)=>{C.current||(q&&M&&M!==b&&Rl(K=>[...K,M]),v(b))},Gl=(b=D,q=U,K=Q,ot=B)=>o.find(Cl=>O(Cl,b,q,K)&&!ot.has(Cl.key))?.key||null,pl=(b=o,q=B)=>{const K=b.filter(Cl=>O(Cl)&&!q.has(Cl.key)&&Cl.key!==M),ot=b.findIndex(Cl=>Cl.key===M);P((K.find(Cl=>b.indexOf(Cl)>ot)||K[0])?.key||null)};async function fe(b=!1){if(!C.current){C.current=!0,zl(!0);try{const q=await ii(b?"/api/refresh":"/api/state",b?{}:void 0);N(q.items),v(q.items.find(K=>K.key===M&&O(K))?.key||q.items.find(K=>O(K)&&!B.has(K.key))?.key||null),b&&V("目录已刷新")}catch(q){V(q.message,!0)}finally{C.current=!1,zl(!1)}}}async function Tt(b,q,K){if(!(C.current||!m)){C.current=!0,zl(!0);try{const ot=await ii("/api/"+b,{key:m.key,revision:m.revision,result:q?.name,reason:typeof q=="string"?q:void 0,png:K}),Cl=o.map(rt=>rt.key===M?ot.item:rt);N(Cl);const Ht=new Set(B);Ht.delete(M),fl(Ht),C.current=!1,pt(null),b!=="clear"&&pl(Cl,Ht),V(b==="clear"?"已撤销标注":"已保存 · "+m.id)}catch(ot){V(ot.message,!0)}finally{C.current=!1,zl(!1)}}}async function la(b=m){if(!(C.current||!b?.perfect)){C.current=!0,zl(!0);try{const q=await ii("/api/meat-labels?key="+encodeURIComponent(b.key));j(!1),tt(q)}catch(q){V(q.message,!0)}finally{C.current=!1,zl(!1)}}}const La=()=>{C.current||p&&!window.confirm("分类标注尚未保存,放弃本次修改?")||(tt(null),j(!1))};async function Zt(b,q,K,ot=!1){if(!(C.current||!bl)){C.current=!0,zl(!0);try{const Cl=await ii("/api/meat-labels",{key:bl.key,revision:bl.revision,skin_revision:bl.skin_revision,meat_revision:bl.meat_revision,semantic_revision:bl.semantic.semantic_revision,labels:b,assistance:K,fine_review_complete:ot});window.dispatchEvent(new Event("meat-saved"));const Ht=o.map(rt=>rt.key===bl.key?Cl.item:rt);if(N(Ht),tt(null),j(!1),V("分类已保存 · "+bl.id+" · "+b.filter(Boolean).length+" 格"),C.current=!1,q){const rt=Ht.findIndex(se=>se.key===bl.key),na=[...Ht.slice(rt+1),...Ht.slice(0,rt)].find(se=>se.perfect&&se.meat_status!=="saved"&&(!U||ni(se)===U)&&se.id.toLowerCase().includes(Q.trim().toLowerCase()));na?(P(na.key),await la(na)):V("当前范围内的 perfect 皮肤已全部完成 meat 标注")}}catch(Cl){V(Cl.message,!0)}finally{C.current=!1,zl(!1)}}}function ta(){if(C.current||!m)return;const b=new Set(B);b.add(M),fl(b),pl(o,b)}function ea(){!C.current&&Al.length&&(v(Al.at(-1)),Rl(Al.slice(0,-1)))}X.useEffect(()=>{fe()},[]),X.useEffect(()=>py(Ol,rl,Nl),[Ol,rl,Nl,M]),X.useEffect(()=>{if(!Dl)return;const b=setTimeout(()=>ql(null),Dl.error?8e3:3500);return()=>clearTimeout(b)},[Dl]),X.useEffect(()=>{Pl&&sl.current?.showModal()},[Pl]),X.useEffect(()=>{Ul&&ol.current?.showModal()},[Ul]),X.useEffect(()=>{bl&&d.current?.showModal()},[bl]),X.useEffect(()=>{const b=q=>{if(!(F||Pl||Ul||bl||q.ctrlKey||q.metaKey||q.altKey||q.target.closest("input,select,textarea,[contenteditable]"))){if(q.key.toLowerCase()==="s")q.preventDefault(),ta();else if(q.key==="ArrowLeft")q.preventDefault(),ea();else if(q.key==="ArrowRight")q.preventDefault(),pl();else if(/^[1-9]$/.test(q.key)){const K=m?.results[+q.key-1];K&&(q.preventDefault(),Tt("choose",K))}}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const Vt=o.filter(b=>!U||ni(b)===U),aa=Vt.filter(Re).length,ua=aa+Vt.filter(b=>b.results.length&&!Re(b)).length,Ka={done:Vt.filter(Re).length,pending:Vt.filter(b=>b.results.length&&!Re(b)).length,rejected:Vt.filter(b=>b.rejection).length,all:Vt.length,no_results:Vt.filter(b=>!b.results.length).length},Ja=b=>{C.current||(L(b),P(Gl(b)))};return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-icon",children:"D"}),y.jsxs("div",{children:[y.jsx("h1",{children:"DDJ 最佳结果标注"}),y.jsx("p",{children:"对照原图,选出最好的皮肤"})]})]}),y.jsxs("div",{className:"progress",children:[y.jsxs("div",{children:[y.jsx("span",{children:"标注进度"}),y.jsxs("strong",{id:"progressText",children:[aa," / ",ua]})]}),y.jsx("div",{className:"progress-track",children:y.jsx("i",{style:{width:`${aa/(ua||1)*100}%`}})})]}),y.jsx("button",{id:"refresh",className:"button secondary",disabled:F,onClick:()=>fe(!0),children:"刷新目录"})]}),y.jsxs("section",{className:"filters",children:[y.jsx("div",{className:"segments",children:Object.entries({pending:"待标注",done:"已标注",rejected:"不满意",all:"全部",no_results:"无结果"}).map(([b,q])=>y.jsxs("button",{"data-filter":b,disabled:F,className:D===b?"active":"",onClick:()=>Ja(b),children:[q," ",y.jsx("b",{id:`${{all:"total",no_results:"noResult"}[b]||b}Count`,children:Ka[b]})]},b))}),y.jsxs("select",{id:"folder","aria-label":"模型目录",disabled:F,value:U,onChange:b=>{T(b.target.value),P(Gl(D,b.target.value))},children:[y.jsx("option",{value:"",children:"所有模型"}),[...new Set(o.map(ni))].map(b=>y.jsx("option",{children:b},b))]}),y.jsx("input",{id:"search",type:"search","aria-label":"搜索编号",placeholder:"搜索编号…",disabled:F,value:Q,onChange:b=>{R(b.target.value),P(Gl(D,U,b.target.value))}})]}),D==="done"&&y.jsxs("section",{className:"annotation-filters","aria-label":"已标注类型筛选",children:[y.jsx("label",{htmlFor:"annotationType",children:"标注类型"}),y.jsx("select",{id:"annotationType",disabled:F,value:$,onChange:b=>{const q=b.target.value;nl(q),P(o.find(K=>O(K,"done",U,Q,q)&&!B.has(K.key))?.key||null)},children:Object.entries(Oy).map(([b,q])=>y.jsxs("option",{value:b,children:[q," ·"," ",o.filter(K=>O(K,"done",U,Q,b)).length]},b))}),y.jsx("span",{children:"可与数据目录、编号搜索组合筛选"})]}),y.jsx(Ty,{}),y.jsx("main",{children:m?y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"item-heading",children:[y.jsxs("div",{children:[y.jsx("span",{className:"eyebrow",children:m.folder}),y.jsx("h2",{id:"itemId",children:m.id}),y.jsxs("p",{id:"itemInfo",children:[m.results.length," 个结果版本 ·"," ",m.annotation_conflict?"标注冲突,请重新选择":m.invalid_best||m.invalid_rejection?"标注已失效,请重新选择":m.perfect?"已选最佳(完美)":m.best?"已保存最佳结果":m.rejection?qr(m.rejection):"请选择最佳结果、标记不满意,或暂时忽略"]})]}),y.jsxs("div",{className:"jump",children:[y.jsx("label",{htmlFor:"jump",children:"跳转条目"}),y.jsx("select",{id:"jump",disabled:F,value:M,onChange:b=>{const q=new Set(B);q.delete(b.target.value),fl(q),P(b.target.value)},children:J.map(b=>y.jsxs("option",{value:b.key,children:[b.perfect?"★ ":Re(b)?"✓ ":"",b.id]},b.key))})]})]}),y.jsxs("div",{className:"workspace",id:"workspace",children:[y.jsxs("aside",{className:"source-panel panel",children:[y.jsx("div",{className:"reference-images",children:[["source","原图",m.source_url],["edited","中间图",m.edited_url]].map(([b,q,K])=>y.jsxs("section",{className:"reference-image",children:[y.jsxs("div",{className:"panel-title",children:[y.jsxs("h3",{children:[b," · ",q]}),y.jsx("span",{children:b==="source"&&m.source_error?"err 样例":""})]}),y.jsx("button",{hidden:!K,id:b==="source"?"enlargeSource":"enlargeEdited",className:"source-image-button",onClick:()=>wl({url:K,title:m.id+"_"+b}),children:y.jsx("img",{id:b+"Image",src:K||void 0,alt:q})}),b==="edited"&&y.jsx("div",{id:"missingEdited",className:"missing-edited",hidden:!!K,children:"暂无 edited 图片"})]},b))}),y.jsx("div",{className:"source-caption",children:"原图与中间图同时对照 · 点击任意图片放大"}),y.jsxs("div",{className:"reject-actions",children:[y.jsx("button",{id:"rejectResults",className:"button reject-button",disabled:F||!m.results.length||m.rejection==="result_unsatisfied",onClick:()=>Tt("reject","result_unsatisfied"),children:"结果都不满意"}),y.jsx("button",{id:"rejectEdited",className:"button reject-button",disabled:F||!m.edited_url||m.rejection==="edited_unsatisfied",onClick:()=>Tt("reject","edited_unsatisfied"),children:"edited 不满意"})]}),y.jsxs("div",{id:"savedBox",className:"saved-box",hidden:!Re(m)&&!m.invalid_best&&!m.invalid_rejection&&!m.annotation_conflict,children:[y.jsxs("span",{children:["当前标注",m.perfect?" · 完美":""]}),y.jsx("strong",{id:"savedName",children:m.rejection?qr(m.rejection):m.best||"原标注需要重新选择"}),m.perfect_url&&y.jsx("button",{className:"text-button",onClick:()=>wl({url:m.perfect_url,title:m.id+"_perfect.png",pixelated:!0}),children:"查看修复后的皮肤"}),m.perfect&&y.jsxs("div",{className:"meat-entry",children:[y.jsx("button",{id:"annotateMeat",className:"button",disabled:F,onClick:()=>la(),children:m.meat_status==="saved"?"继续编辑分类":"标注皮肤分类"}),y.jsx("p",{className:"meat-status",children:m.meat_status==="saved"?`已标注 ${m.meat_count} 格 meat`:m.meat_status==="stale"?"旧 meat 标注与当前 perfect 不匹配,需要重新标注":"此 perfect 皮肤尚未标注 meat"})]}),y.jsx("button",{id:"clearBest",className:"text-button",disabled:F,onClick:()=>Tt("clear"),children:"撤销此标注"})]}),y.jsx("p",{className:"save-note",children:"保存后自动进入下一项。暂时忽略不会写入文件。"})]}),y.jsxs("section",{className:"comparison",children:[y.jsxs("div",{className:"comparison-toolbar",children:[y.jsxs("div",{className:"camera-buttons",children:[y.jsx("span",{children:"同步视角"}),Object.entries({angle:"斜前",front:"正面",back:"背面",head:"头部"}).map(([b,q])=>y.jsx("button",{"data-camera":b,className:Ol===b?"active":"",onClick:()=>Sl(b),children:q},b))]}),y.jsxs("div",{className:"view-options",children:[y.jsxs("label",{children:[y.jsx("input",{id:"outerLayer",type:"checkbox",checked:rl,onChange:b=>I(b.target.checked)}),"显示外层"]}),y.jsx("button",{id:"uvMode",className:"button tiny","aria-pressed":Nl,onClick:()=>at(!Nl),children:Nl?"显示 3D":"只看 UV"})]})]}),y.jsxs("div",{id:"results",className:"result-grid"+(Nl?" uv-only":""),children:[m.results.map((b,q)=>y.jsxs("article",{"data-result":b.name,className:"result-card"+(m.best===b.name?" selected":""),children:[y.jsxs("div",{className:"result-header",children:[y.jsx("span",{className:"version-name",children:Br(b)}),y.jsx("span",{className:m.best===b.name?"chosen-badge":"version-number",children:m.best===b.name?m.perfect?"最佳 · 完美":"已选最佳":q+1})]}),y.jsx(jy,{result:b}),y.jsxs("div",{className:"uv-area",children:[y.jsx("button",{className:"uv-button",onClick:()=>wl({url:b.url,title:b.name,pixelated:!0}),children:y.jsx("img",{src:b.url,alt:Br(b)+" 的 UV 贴图"})}),y.jsxs("div",{className:"uv-caption",children:[y.jsx("strong",{children:"UV 贴图"}),y.jsx("span",{children:"点击放大"})]})]}),y.jsxs("div",{className:"result-actions",children:[y.jsx("div",{className:"result-file",children:b.name}),y.jsx("button",{className:"choose-button",disabled:F||m.best===b.name&&!m.perfect,onClick:()=>Tt("choose",b),children:m.best===b.name&&!m.perfect?"当前最佳":"选为最佳"}),y.jsx("button",{className:"perfect-button",disabled:F||m.perfect===b.name&&!m.perfect_url,onClick:()=>Tt("perfect",b),children:"选为最佳(完美)"}),y.jsx("button",{className:"repair-button",disabled:F,onClick:()=>pt({result:b,url:m.perfect===b.name&&m.perfect_url?m.perfect_url:b.url}),children:"修复并选为最佳(完美)"})]})]},m.key+b.name)),!m.results.length&&y.jsx("div",{className:"no-result-card",children:"这个 source 暂无 result 图片"})]}),y.jsx("p",{className:"preview-hint",children:"拖动任一模型可同步旋转,滚轮缩放;点击 UV 贴图可放大。"})]})]})]}):y.jsxs("section",{id:"empty",className:"empty panel",children:[y.jsx("h2",{children:"当前筛选下没有更多条目"}),y.jsx("p",{children:"可以切换筛选,或重新查看暂时忽略的条目。"}),y.jsx("button",{id:"resume",className:"button primary",disabled:F,onClick:()=>{fl(new Set),L("pending"),T(""),R(""),P(Gl("pending","","",new Set))},children:"继续查看待标注"})]})}),y.jsxs("footer",{className:"footer",children:[y.jsxs("div",{className:"navigation",children:[y.jsx("button",{id:"previous",className:"button secondary",disabled:F||!Al.length,onClick:ea,children:"← 上一个"}),y.jsx("button",{id:"skip",className:"button secondary",disabled:F||!m,onClick:ta,children:"暂时忽略 →"})]}),y.jsx("span",{className:"keyboard-hint",children:"1–9 选择版本 S 忽略 ← 回看"}),y.jsxs("span",{children:["本次已忽略 ",B.size," 项 · 忽略不保存"]})]}),Dl&&y.jsx("div",{id:"toast",role:"status",className:"toast"+(Dl.error?" error":""),children:Dl.message}),Pl&&y.jsxs("dialog",{id:"imageDialog",ref:sl,onCancel:()=>wl(null),onClick:b=>{b.target===b.currentTarget&&wl(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsx("span",{children:Pl.title}),y.jsx("button",{id:"closeDialog",className:"button secondary",onClick:()=>wl(null),children:"关闭 ×"})]}),y.jsx("div",{className:"dialog-image",children:y.jsx("img",{id:"dialogImage",src:Pl.url,alt:"放大预览",className:Pl.pixelated?"pixelated":""})})]}),Ul&&y.jsxs("dialog",{className:"editor-dialog",ref:ol,onCancel:b=>{b.preventDefault(),F||pt(null)},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["修复 ",Ul.result.name," · 左键绘制,右键旋转"]}),y.jsx("button",{className:"button secondary",disabled:F,onClick:()=>pt(null),children:"取消 ×"})]}),y.jsxs("div",{className:"editor-content",children:[y.jsxs("aside",{className:"editor-reference","aria-label":"edited 参考图",children:[y.jsx("h3",{children:"edited · 参考图"}),m?.edited_url?y.jsx("img",{src:m.edited_url,alt:`${m.id} 的 edited 参考图`}):y.jsx("p",{children:"此条目暂无 edited 图片"})]}),y.jsx("div",{className:"editor-canvas-panel",children:y.jsx(X.Suspense,{fallback:y.jsx("p",{children:"正在加载皮肤编辑器…"}),children:y.jsx(_y,{textureUrl:Ul.url,busy:F,onError:b=>V(b,!0),onSubmit:b=>Tt("repair",Ul.result,b)})})})]}),Dl?.error&&y.jsx("p",{role:"alert",children:Dl.message})]}),bl&&y.jsxs("dialog",{className:"meat-dialog",ref:d,onCancel:b=>{b.preventDefault(),La()},children:[y.jsxs("div",{className:"dialog-top",children:[y.jsxs("span",{children:["皮肤分类 · ",bl.id," · ",bl.model==="slim"?"纤细手臂":"标准手臂"]}),y.jsx("button",{className:"button secondary",disabled:F,onClick:La,children:"关闭 ×"})]}),y.jsx(X.Suspense,{fallback:y.jsx("p",{children:"正在加载分类标注器…"}),children:y.jsx(Ay,{data:bl,busy:F,onSave:Zt,onDirty:j},bl.key)}),Dl?.error&&y.jsx("p",{role:"alert",children:Dl.message})]})]})}gy.createRoot(document.getElementById("root")).render(y.jsx(Dy,{}));export{Uy as M,Ny as R,Of as a,ry as b,cy as g,y as j,X as r}; diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.json index 4c47f679a9daa0e323fb86bedd27e6c43d1be825..51f22b97f836b61a069744331c2c2578c7cc970d 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.json @@ -2,8 +2,8 @@ "schema": "mc-meat-v2", "id": "5B3DVGE17LF1XZPS", "skin_file": "5B3DVGE17LF1XZPS_perfect.png", - "skin_sha256": "7ce6fbb4528603003f20d0dfacac22298cb62c93f71820a5a8f47fee304cb10d", - "mask_sha256": "bc4a3409febb4fe9fc678b083a1f22bad80a1a45571e77666a57a7aaab77df30", + "skin_sha256": "9c50a2fe9d531d5e6b559e86866803fcb72bb5b4885d3d0156b00978a3db0cdb", + "mask_sha256": "9c5c61bd72094d30641000db636b7829a704128a89e0a774770b27f04335a622", "model": "classic", "selected": [ 208, @@ -17,6 +17,7 @@ 589, 590, 649, + 650, 651, 652, 653, @@ -39,6 +40,7 @@ 783, 784, 785, + 787, 835, 836, 839, @@ -47,12 +49,15 @@ 846, 847, 848, + 851, 899, 900, 905, 907, 908, + 910, 915, + 916, 962, 963, 964, @@ -72,6 +77,8 @@ 1201, 1202, 1203, + 1239, + 1240, 1264, 1265, 1266, @@ -79,7 +86,6 @@ 1303, 1304, 1367, - 1368, 1768, 1769, 1770, @@ -212,7 +218,6 @@ 4005, 4006, 4007, - 4008, 4011, 4012, 4013, @@ -235,349 +240,21 @@ 4078, 4079 ], - "selected_count": 228, + "selected_count": 233, "encoding": { "meat": 255, "non_meat": 0, "invalid": "RGBA alpha=0; excluded from labels and loss" }, "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "14a54495ba0095f17a866da167dffd963c44e33d40ab48b1817cf9e2fbce2cff", - "occluded_count": 59, + "valid_sha256": "6faeef706e57dd2055b76095a78ea06c437b5010f078d023eff190a039ff4c6a", + "occluded_count": 64, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 9, - 11, - 5, - 0.55 - ], - [ - 10, - 11, - 5, - 0.55 - ], - [ - 13, - 11, - 5, - 0.55 - ], - [ - 14, - 11, - 5, - 0.55 - ], - [ - 6, - 13, - 6, - 0.6 - ], - [ - 6, - 14, - 6, - 0.6 - ], - [ - 7, - 14, - 6, - 0.6 - ], - [ - 6, - 15, - 6, - 0.6 - ], - [ - 7, - 15, - 6, - 0.6 - ], - [ - 17, - 13, - 6, - 0.6 - ], - [ - 16, - 14, - 6, - 0.6 - ], - [ - 17, - 14, - 6, - 0.6 - ], - [ - 16, - 15, - 6, - 0.6 - ], - [ - 17, - 15, - 6, - 0.6 - ], - [ - 10, - 13, - 6, - 0.6 - ], - [ - 11, - 13, - 6, - 0.6 - ], - [ - 12, - 13, - 6, - 0.6 - ], - [ - 13, - 13, - 6, - 0.6 - ], - [ - 8, - 14, - 6, - 0.6 - ], - [ - 10, - 14, - 6, - 0.6 - ], - [ - 13, - 14, - 6, - 0.6 - ], - [ - 15, - 14, - 6, - 0.6 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ], - [ - 42, - 15, - 6, - 0.6 - ], - [ - 43, - 15, - 6, - 0.6 - ], - [ - 44, - 15, - 6, - 0.6 - ], - [ - 45, - 15, - 6, - 0.6 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ], - [ - 11, - 14, - 3, - 0.5 - ], - [ - 12, - 14, - 3, - 0.5 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ] - ], - "skin_bounds": [ - 165, - 255, - 100, - 230, - 60, - 200, - 20, - 10 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:35:41.289051+00:00", + "assistance": { + "model_id": "manual-v3-2026-11-01-5a13a215", + "checkpoint_sha256": "76c2c5d0359dfe21bd366465d25dbc86613cf325b2f63675867b5ffcf09e72f5", + "human_saved": true, + "note": "Model suggestions were available; final selection explicitly saved by user." + } } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.png index 40dac36a4d03580465ea311f911b4365451fcb28..706440c4ab9880ae553e7206f93ef056e863e43b 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc4a3409febb4fe9fc678b083a1f22bad80a1a45571e77666a57a7aaab77df30 -size 460 +oid sha256:9c5c61bd72094d30641000db636b7829a704128a89e0a774770b27f04335a622 +size 475 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_perfect.png index 336d3c0884354a5d29a28879968db13362d9d7e1..8265e8f3a2ddfee3fad0be43d751f8e11d7c46ea 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_perfect.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_perfect.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ce6fbb4528603003f20d0dfacac22298cb62c93f71820a5a8f47fee304cb10d -size 3788 +oid sha256:9c50a2fe9d531d5e6b559e86866803fcb72bb5b4885d3d0156b00978a3db0cdb +size 4150 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.json index e21244b06e543979aa9d7ce0d748c3c6413b6e49..c20eac2b8218274c18c06723481f21e311112666 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.json @@ -197,14 +197,14 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, 0, 0, 0, @@ -262,12 +262,12 @@ 0, 0, 1, - 0, - 0, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, + 6, + 6, 1, 0, 0, @@ -703,7 +703,7 @@ 0, 0, 1, - 0, + 1, 1, 1, 1, @@ -826,7 +826,7 @@ 0, 1, 1, - 0, + 6, 1, 1, 1, @@ -839,8 +839,8 @@ 1, 1, 1, - 0, - 0, + 6, + 1, 0, 0, 0, @@ -904,7 +904,7 @@ 1, 6, 6, - 0, + 1, 0, 0, 0, @@ -963,13 +963,13 @@ 3, 3, 6, - 0, + 1, 6, 6, 6, 6, 1, - 0, + 1, 0, 0, 0, @@ -1292,8 +1292,8 @@ 0, 0, 0, - 0, - 0, + 1, + 1, 0, 0, 0, @@ -1421,7 +1421,7 @@ 0, 0, 1, - 1, + 0, 0, 0, 0, @@ -4061,7 +4061,7 @@ 1, 1, 1, - 1, + 0, 0, 0, 1, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 295, - "mask_sha256": "972c6a994b1d3e3830002fa9b69fd7ca1504c6fc8e87a2b9ee05877decf2f5dd", + "known_count": 316, + "mask_sha256": "aa9ccf1cda81bb2d22f299aac8d566eaca9047b02bb15dea2c03c78dab109c86", "skin_file": "5B3DVGE17LF1XZPS_perfect.png", - "skin_sha256": "7ce6fbb4528603003f20d0dfacac22298cb62c93f71820a5a8f47fee304cb10d", - "meat_revision": "2f4f70c6c06456253f08538ec849114ecd9cc27a1ebbe94e75ebc1e22b11b35e", + "skin_sha256": "9c50a2fe9d531d5e6b559e86866803fcb72bb5b4885d3d0156b00978a3db0cdb", + "meat_revision": "8767e5c0b30e43abce97c2c90b0cd2103ca3359c42aab5f4d0b946b3b46b8190", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "14a54495ba0095f17a866da167dffd963c44e33d40ab48b1817cf9e2fbce2cff", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.55, - 0.55, - 0.65, - 0.65, - 0.55, - 0.55, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.6, - 0.65, - 0.65, - 0.6, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.6, - 0.5, - 0.5, - 0.6, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "valid_sha256": "6faeef706e57dd2055b76095a78ea06c437b5010f078d023eff190a039ff4c6a", + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:35:41.327539+00:00", + "assistant_parent_sha256": "63aed94b3f6fbd470e2e6d96a325152eb42dbd01e09caddfc8de0c8b59abbc5f", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "6faeef706e57dd2055b76095a78ea06c437b5010f078d023eff190a039ff4c6a" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.png index 3b616e77c7861ee9e3d9d121122a850eadf91859..72017d4a3f31b32b829bc00c51ac4ea14f0b90d5 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5B3/5B3DVGE17LF1XZPS_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:972c6a994b1d3e3830002fa9b69fd7ca1504c6fc8e87a2b9ee05877decf2f5dd -size 499 +oid sha256:aa9ccf1cda81bb2d22f299aac8d566eaca9047b02bb15dea2c03c78dab109c86 +size 511 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.json index bcf6ee0337df98f363b751603e886a44f1e6337e..ad5a9e74457d83ae46230ac106a4e31b64f92e0c 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.json @@ -3,7 +3,7 @@ "id": "5VA4RTU2NQ11YKSM", "skin_file": "5VA4RTU2NQ11YKSM_perfect.png", "skin_sha256": "830e0be2b9fe402eeacbedb210daeb1b01f1b97db089cd2dd2034432e1551a83", - "mask_sha256": "e0e4495e18ea08ccde0de4e499ff1bc1e5562dd30dcf992cf5cf25a9166503e8", + "mask_sha256": "189ecccb84d7f9d8f9688da3ffb4bb13a5acb6c8bc81299ae7d36b5ff6264e3d", "model": "classic", "selected": [ 80, @@ -44,6 +44,8 @@ 840, 841, 842, + 843, + 844, 845, 846, 847, @@ -52,6 +54,10 @@ 851, 899, 900, + 905, + 907, + 908, + 910, 915, 916, 961, @@ -227,7 +233,7 @@ 4078, 4079 ], - "selected_count": 220, + "selected_count": 226, "encoding": { "meat": 255, "non_meat": 0, @@ -237,363 +243,5 @@ "valid_sha256": "75eb6bddb0a957ac7bc868fa744d4227b3d0500c0816c90e6db79a895c579b3a", "occluded_count": 29, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 9, - 11, - 5, - 0.55 - ], - [ - 10, - 11, - 5, - 0.55 - ], - [ - 13, - 11, - 5, - 0.55 - ], - [ - 14, - 11, - 5, - 0.55 - ], - [ - 6, - 14, - 6, - 0.6 - ], - [ - 7, - 14, - 6, - 0.6 - ], - [ - 6, - 15, - 6, - 0.6 - ], - [ - 7, - 15, - 6, - 0.6 - ], - [ - 16, - 14, - 6, - 0.6 - ], - [ - 17, - 14, - 6, - 0.6 - ], - [ - 16, - 15, - 6, - 0.6 - ], - [ - 17, - 15, - 6, - 0.6 - ], - [ - 8, - 14, - 6, - 0.6 - ], - [ - 10, - 14, - 6, - 0.6 - ], - [ - 11, - 14, - 6, - 0.6 - ], - [ - 12, - 14, - 6, - 0.6 - ], - [ - 13, - 14, - 6, - 0.6 - ], - [ - 15, - 14, - 6, - 0.6 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ], - [ - 41, - 15, - 6, - 0.6 - ], - [ - 42, - 15, - 6, - 0.6 - ], - [ - 43, - 15, - 6, - 0.6 - ], - [ - 44, - 15, - 6, - 0.6 - ], - [ - 45, - 15, - 6, - 0.6 - ], - [ - 46, - 15, - 6, - 0.6 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ], - [ - 8, - 14, - 6, - 0.6 - ], - [ - 9, - 14, - 6, - 0.6 - ], - [ - 10, - 14, - 6, - 0.6 - ], - [ - 11, - 14, - 6, - 0.6 - ], - [ - 12, - 14, - 6, - 0.6 - ], - [ - 13, - 14, - 6, - 0.6 - ], - [ - 14, - 14, - 6, - 0.6 - ], - [ - 15, - 14, - 6, - 0.6 - ] - ], - "skin_bounds": [ - 160, - 255, - 95, - 225, - 60, - 195, - 20, - 8 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:36:29.330450+00:00" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.png index 05d6e1db648ae12366e8c021117e044da2513dc4..6e840ed2e679611fa644b787d826755dff83d837 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e0e4495e18ea08ccde0de4e499ff1bc1e5562dd30dcf992cf5cf25a9166503e8 -size 396 +oid sha256:189ecccb84d7f9d8f9688da3ffb4bb13a5acb6c8bc81299ae7d36b5ff6264e3d +size 399 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.json index 310849e9074a4229e8ad27a14743463d637499c3..58d19736c1545fc666887f4d30ec28925cafe373 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.json @@ -826,7 +826,7 @@ 0, 1, 1, - 0, + 6, 1, 1, 1, @@ -839,7 +839,7 @@ 1, 1, 1, - 0, + 6, 1, 0, 0, @@ -896,8 +896,8 @@ 1, 1, 1, - 6, - 6, + 10, + 10, 1, 1, 1, @@ -958,12 +958,12 @@ 6, 6, 6, + 1, 6, + 3, + 3, 6, - 6, - 6, - 6, - 6, + 1, 6, 6, 6, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 288, - "mask_sha256": "bad66939cb3296353e6eeb0a5101275e56380f7d0bead7edbbc922a0e9a32a9c", + "known_count": 290, + "mask_sha256": "2b3caba1516dd98d8ac2061cc5154308937c2994fe13a1bb3814968f5ba2b710", "skin_file": "5VA4RTU2NQ11YKSM_perfect.png", "skin_sha256": "830e0be2b9fe402eeacbedb210daeb1b01f1b97db089cd2dd2034432e1551a83", - "meat_revision": "faf078683a55f7a2af263dea788f24e715352126093fbe2fe8679c9144ed17f5", + "meat_revision": "d8d0fbc67229d278295d2255a99a55b1dab0239a2e584d0b74b8ed46258afcd1", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", "valid_sha256": "75eb6bddb0a957ac7bc868fa744d4227b3d0500c0816c90e6db79a895c579b3a", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.55, - 0.55, - 0.65, - 0.65, - 0.55, - 0.55, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:36:29.377802+00:00", + "assistant_parent_sha256": "5a17d7df36ceb9a16976dbb89ce2f87c2e8b8ccad1eb98cec96f9f08fce546b8", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "75eb6bddb0a957ac7bc868fa744d4227b3d0500c0816c90e6db79a895c579b3a" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.png index ffc55312238eb85282786efee4a5b7829caad0b7..50b43a9ce250573937befabc45d566657c61de5b 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/5VA/5VA4RTU2NQ11YKSM_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bad66939cb3296353e6eeb0a5101275e56380f7d0bead7edbbc922a0e9a32a9c -size 447 +oid sha256:2b3caba1516dd98d8ac2061cc5154308937c2994fe13a1bb3814968f5ba2b710 +size 460 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9543836213e3226e338d12de95a8d8b994d83a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_all_rejected.txt @@ -0,0 +1 @@ +edited_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_best.txt deleted file mode 100644 index db326d63abb1e0b30a957ba4a292928cf544ce55..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_best.txt +++ /dev/null @@ -1 +0,0 @@ -79BC1C6F7BLFLAPZ_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.png deleted file mode 100644 index e82b84e952fa2440e40f45c57b2ec5e5193c494c..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5c56379292320dfbed3e55c87df563bd51087c444599e682cb3f66674394abe4 -size 4762 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.txt deleted file mode 100644 index db326d63abb1e0b30a957ba4a292928cf544ce55..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/79B/79BC1C6F7BLFLAPZ_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -79BC1C6F7BLFLAPZ_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.json index 83ed855b3eeb2b4192f775a767ad35120bc69009..a7a3972207d90fcafee0dd2ae419c8fa2169fd04 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.json @@ -3,7 +3,7 @@ "id": "7UCVBM2GWKNDVUXV", "skin_file": "7UCVBM2GWKNDVUXV_perfect.png", "skin_sha256": "e0d3bf7adab5c0acc21b897304d558acfaeed7a79d58efa8a76df019bd294155", - "mask_sha256": "2e07963cde98925fd6f155223fd633ebb8ed88c8dd7564ed81ddf46cfeb05c5e", + "mask_sha256": "ee2535eb980d17c8e58d51c09e39ffad54e5dd22142f51499547d119c737ffc4", "model": "classic", "selected": [ 208, @@ -52,11 +52,11 @@ 851, 900, 905, - 907, - 908, 915, 963, 964, + 971, + 972, 978, 979, 980, @@ -300,363 +300,5 @@ "valid_sha256": "7f2a910c3e570aa09a329e07cc5433c9af3c3e0cefed24621bf9813cf631ba64", "occluded_count": 92, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 9, - 11, - 5, - 0.55 - ], - [ - 10, - 11, - 5, - 0.55 - ], - [ - 13, - 11, - 5, - 0.55 - ], - [ - 14, - 11, - 5, - 0.55 - ], - [ - 6, - 13, - 6, - 0.6 - ], - [ - 6, - 14, - 6, - 0.6 - ], - [ - 7, - 14, - 6, - 0.6 - ], - [ - 6, - 15, - 6, - 0.6 - ], - [ - 7, - 15, - 6, - 0.6 - ], - [ - 17, - 13, - 6, - 0.6 - ], - [ - 16, - 14, - 6, - 0.6 - ], - [ - 16, - 15, - 6, - 0.6 - ], - [ - 17, - 15, - 6, - 0.6 - ], - [ - 8, - 14, - 6, - 0.6 - ], - [ - 10, - 14, - 6, - 0.6 - ], - [ - 11, - 14, - 6, - 0.6 - ], - [ - 12, - 14, - 6, - 0.6 - ], - [ - 13, - 14, - 6, - 0.6 - ], - [ - 15, - 14, - 6, - 0.6 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ], - [ - 38, - 14, - 6, - 0.6 - ], - [ - 39, - 14, - 6, - 0.6 - ], - [ - 49, - 13, - 6, - 0.6 - ], - [ - 48, - 14, - 6, - 0.6 - ], - [ - 49, - 14, - 6, - 0.6 - ], - [ - 40, - 14, - 6, - 0.6 - ], - [ - 47, - 14, - 6, - 0.6 - ], - [ - 41, - 15, - 6, - 0.6 - ], - [ - 42, - 15, - 6, - 0.6 - ], - [ - 43, - 15, - 6, - 0.6 - ], - [ - 44, - 15, - 6, - 0.6 - ], - [ - 45, - 15, - 6, - 0.6 - ], - [ - 46, - 15, - 6, - 0.6 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ], - [ - 11, - 14, - 3, - 0.55 - ], - [ - 12, - 14, - 3, - 0.55 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ] - ], - "skin_bounds": [ - 160, - 255, - 95, - 215, - 60, - 185, - 20, - 8 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:37:58.435728+00:00" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.png index f420780f905abbd947bd2b275315451094b6393f..40c7072c8b84022b11b9c16dba720b4ea814f1a5 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e07963cde98925fd6f155223fd633ebb8ed88c8dd7564ed81ddf46cfeb05c5e -size 521 +oid sha256:ee2535eb980d17c8e58d51c09e39ffad54e5dd22142f51499547d119c737ffc4 +size 524 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.json index a4304a6c5d24bc5d04475af959e2e8c653237713..7ea82cd75612a5ba3d98294c9d20b547d94a6e8f 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.json @@ -826,7 +826,7 @@ 0, 0, 1, - 0, + 6, 1, 1, 1, @@ -960,10 +960,10 @@ 6, 1, 6, - 3, - 3, 6, - 0, + 6, + 6, + 6, 6, 6, 0, @@ -1024,8 +1024,8 @@ 6, 6, 6, - 6, - 6, + 3, + 3, 6, 6, 6, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 352, - "mask_sha256": "0f35e1bbcb3fdaddfaef619ae4f39f9e2d6227c346971b9295e8c565b0663649", + "known_count": 354, + "mask_sha256": "f66c971f07e320822e7bf4baaf3b109760ef056ef3507567161fb9f8befbc825", "skin_file": "7UCVBM2GWKNDVUXV_perfect.png", "skin_sha256": "e0d3bf7adab5c0acc21b897304d558acfaeed7a79d58efa8a76df019bd294155", - "meat_revision": "08185533974a574d0fe966ba2f6d0f2b01edda2404d059ce61c4f93ec1f07c8b", + "meat_revision": "9824b91287d2f932d02b1453092416323f8521e1602d44eb22be2f5805c314ec", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", "valid_sha256": "7f2a910c3e570aa09a329e07cc5433c9af3c3e0cefed24621bf9813cf631ba64", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.55, - 0.55, - 0.0, - 0.0, - 0.55, - 0.55, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.6, - 0.55, - 0.55, - 0.6, - 0.0, - 0.6, - 0.6, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:37:58.483525+00:00", + "assistant_parent_sha256": "87962189d035a25baa7174a01ee72f4e77eb1e9085203de8989be469759a9c1f", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "7f2a910c3e570aa09a329e07cc5433c9af3c3e0cefed24621bf9813cf631ba64" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.png index 360c4c9bf7b9f3bcf578082d3a4a622922e3a31a..9063f88792b23733f927b2bfbcf53f8685c38765 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/7UC/7UCVBM2GWKNDVUXV_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f35e1bbcb3fdaddfaef619ae4f39f9e2d6227c346971b9295e8c565b0663649 -size 563 +oid sha256:f66c971f07e320822e7bf4baaf3b109760ef056ef3507567161fb9f8befbc825 +size 558 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9543836213e3226e338d12de95a8d8b994d83a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_all_rejected.txt @@ -0,0 +1 @@ +edited_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_best.txt deleted file mode 100644 index b6050a28cbb6d7a3002f0715375e21eb3e2df60c..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_best.txt +++ /dev/null @@ -1 +0,0 @@ -8FZ7ZTJ95YRXCDMN_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.png deleted file mode 100644 index 26d7d24459041cf05b8ccb583aec57cc8e1ab589..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e46d25f9e7689f9da30410817e0d80e9f8a97d0c3a54a4525e263ce71ca26963 -size 4224 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.txt deleted file mode 100644 index b6050a28cbb6d7a3002f0715375e21eb3e2df60c..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/8FZ/8FZ7ZTJ95YRXCDMN_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -8FZ7ZTJ95YRXCDMN_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..54d49062cddc1a0e674e543000529e45d6cfdbb1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_all_rejected.txt @@ -0,0 +1 @@ +result_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_best.txt deleted file mode 100644 index 264bc911af0324b133f916de3cd2e1fa6e57f6ff..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_best.txt +++ /dev/null @@ -1 +0,0 @@ -9G9ZQCUVSDJLBG94_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.png deleted file mode 100644 index c9ed95a713031ed6e84aff57640b4a28c475500f..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:04ed375ce005c5cdc5f38e27ec37eb210b408294d783165adddd0971c7aa8a48 -size 3462 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.txt deleted file mode 100644 index 264bc911af0324b133f916de3cd2e1fa6e57f6ff..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/9G9/9G9ZQCUVSDJLBG94_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -9G9ZQCUVSDJLBG94_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9543836213e3226e338d12de95a8d8b994d83a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_all_rejected.txt @@ -0,0 +1 @@ +edited_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_best.txt deleted file mode 100644 index 5cdb78c6cd8071d84deb9a91ad42c0d189bbda0a..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_best.txt +++ /dev/null @@ -1 +0,0 @@ -A57GPBXDYFE27D6X_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.png deleted file mode 100644 index 0f77b80db41d43ed554b2d775e5ed5dea43808d5..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dc32600ebb965fa4bc4ce87d79b7c64a4e9a676ed40e4e3c7a8edb97f966795f -size 4297 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.txt deleted file mode 100644 index 5cdb78c6cd8071d84deb9a91ad42c0d189bbda0a..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/A57/A57GPBXDYFE27D6X_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -A57GPBXDYFE27D6X_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9543836213e3226e338d12de95a8d8b994d83a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_all_rejected.txt @@ -0,0 +1 @@ +edited_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_best.txt deleted file mode 100644 index 57d08e180925139fafb541173cd71a297db8dfc3..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_best.txt +++ /dev/null @@ -1 +0,0 @@ -FQXHVCJDG4EPDK7B_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.png deleted file mode 100644 index 3f9a2427e6ec7595407440801601a5719971ad5e..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c91dc17e7ce7ee5a55692fb4c9dd2da3d7f678e5b103f4d80a6dfc79be084f15 -size 3443 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.txt deleted file mode 100644 index 57d08e180925139fafb541173cd71a297db8dfc3..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/FQX/FQXHVCJDG4EPDK7B_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -FQXHVCJDG4EPDK7B_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.json index 294514a39f43c98addedcedbaac933071d672c3d..e036aba164201f8008e01cef3691baec3e4ca422 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.json @@ -2,8 +2,8 @@ "schema": "mc-meat-v2", "id": "H1NZQTDSL8PCF5KD", "skin_file": "H1NZQTDSL8PCF5KD_perfect.png", - "skin_sha256": "dfa84e675457c4f71498aca18dd1fb279e8c6479cb819abbd4b2747907ac9a82", - "mask_sha256": "afe47c4c5ffc0a285f72873338413f2d8f32ecd75afe3dd2269b77c6b5adb7c0", + "skin_sha256": "149cbfb73a5e279a6f0b4fbb1fdb8dad9f7ab52f68c1597d5866b1687281f362", + "mask_sha256": "e5e7d266100b679ece41db7fc46afd6fe77832f9bbf88122258941b2f36b505e", "model": "classic", "selected": [ 16, @@ -28,6 +28,7 @@ 279, 336, 337, + 338, 342, 343, 401, @@ -57,8 +58,10 @@ 708, 710, 711, + 712, 715, 716, + 719, 720, 721, 723, @@ -81,8 +84,6 @@ 788, 835, 836, - 839, - 840, 841, 842, 843, @@ -107,6 +108,7 @@ 963, 964, 965, + 971, 972, 978, 979, @@ -118,23 +120,56 @@ 985, 990, 991, + 1032, + 1033, + 1034, + 1035, 1072, 1073, 1074, 1075, + 1096, + 1097, + 1098, + 1099, 1136, 1137, 1138, 1139, + 1160, + 1161, + 1162, + 1163, 1200, 1201, 1202, 1203, + 1224, + 1225, + 1226, + 1227, 1264, 1265, 1266, 1267, 1897, + 1902, + 1920, + 1921, + 1922, + 1923, + 1924, + 1925, + 1926, + 1927, + 1928, + 1929, + 1930, + 1931, + 1932, + 1933, + 1934, + 1935, 1960, 1961, 1962, @@ -151,6 +186,22 @@ 1973, 1974, 1975, + 1984, + 1985, + 1986, + 1987, + 1988, + 1989, + 1990, + 1991, + 1992, + 1993, + 1994, + 1995, + 1996, + 1997, + 1998, + 1999, 2024, 2025, 2026, @@ -167,24 +218,55 @@ 2037, 2038, 2039, + 3096, + 3097, + 3098, + 3099, 3112, 3113, 3114, 3115, + 3160, + 3161, + 3162, + 3163, 3176, 3177, 3178, 3179, + 3224, + 3225, + 3226, + 3227, 3240, 3241, 3242, 3243, + 3288, + 3289, + 3290, + 3291, 3304, 3305, 3306, 3307, - 3945, - 3946, + 3974, + 3984, + 3985, + 3986, + 3987, + 3988, + 3989, + 3990, + 3991, + 3992, + 3993, + 3994, + 3995, + 3996, + 3997, + 3998, + 3999, 4000, 4001, 4002, @@ -201,6 +283,22 @@ 4013, 4014, 4015, + 4048, + 4049, + 4050, + 4051, + 4052, + 4053, + 4054, + 4055, + 4056, + 4057, + 4058, + 4059, + 4060, + 4061, + 4062, + 4063, 4064, 4065, 4066, @@ -218,259 +316,21 @@ 4078, 4079 ], - "selected_count": 211, + "selected_count": 309, "encoding": { "meat": 255, "non_meat": 0, "invalid": "RGBA alpha=0; excluded from labels and loss" }, "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "de5b59e9755f9265b17eef505544955172dcd2c846873b9283af31b5cf8cb906", - "occluded_count": 3, + "valid_sha256": "623ccb86a1ef53003ae0f9cc90a2d77657935e503314340dc9601590c5872211", + "occluded_count": 5, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 9, - 11, - 5, - 0.55 - ], - [ - 10, - 11, - 5, - 0.55 - ], - [ - 13, - 11, - 5, - 0.55 - ], - [ - 14, - 11, - 5, - 0.55 - ], - [ - 6, - 14, - 6, - 0.7 - ], - [ - 7, - 14, - 6, - 0.7 - ], - [ - 6, - 15, - 6, - 0.7 - ], - [ - 7, - 15, - 6, - 0.7 - ], - [ - 16, - 14, - 6, - 0.7 - ], - [ - 17, - 14, - 6, - 0.7 - ], - [ - 16, - 15, - 6, - 0.7 - ], - [ - 17, - 15, - 6, - 0.7 - ], - [ - 8, - 14, - 6, - 0.7 - ], - [ - 10, - 14, - 6, - 0.7 - ], - [ - 11, - 14, - 6, - 0.7 - ], - [ - 12, - 14, - 6, - 0.7 - ], - [ - 13, - 14, - 6, - 0.7 - ], - [ - 15, - 14, - 6, - 0.7 - ], - [ - 8, - 15, - 6, - 0.7 - ], - [ - 9, - 15, - 6, - 0.7 - ], - [ - 10, - 15, - 6, - 0.7 - ], - [ - 11, - 15, - 6, - 0.7 - ], - [ - 13, - 15, - 6, - 0.7 - ], - [ - 14, - 15, - 6, - 0.7 - ], - [ - 15, - 15, - 6, - 0.7 - ], - [ - 49, - 14, - 6, - 0.7 - ], - [ - 47, - 14, - 6, - 0.7 - ], - [ - 44, - 15, - 6, - 0.7 - ], - [ - 47, - 15, - 6, - 0.7 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ] - ], - "skin_bounds": [ - 125, - 220, - 70, - 175, - 30, - 130, - 20, - 10 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:43:43.124954+00:00", + "assistance": { + "model_id": "manual-v3-2026-11-01-5a13a215", + "checkpoint_sha256": "76c2c5d0359dfe21bd366465d25dbc86613cf325b2f63675867b5ffcf09e72f5", + "human_saved": true, + "note": "Model suggestions were available; final selection explicitly saved by user." + } } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.png index 3f9d158328dbd026da74249ee13c9ea0c2588b70..fec2d43846ece986e7be59e74b1b06ccb12da943 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:afe47c4c5ffc0a285f72873338413f2d8f32ecd75afe3dd2269b77c6b5adb7c0 -size 361 +oid sha256:e5e7d266100b679ece41db7fc46afd6fe77832f9bbf88122258941b2f36b505e +size 366 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_perfect.png index ba3f8e73915cf662878b785b44275b05447d2c1d..014e17164ea03274361272068000730ef8113f5a 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_perfect.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_perfect.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dfa84e675457c4f71498aca18dd1fb279e8c6479cb819abbd4b2747907ac9a82 -size 3692 +oid sha256:149cbfb73a5e279a6f0b4fbb1fdb8dad9f7ab52f68c1597d5866b1687281f362 +size 4107 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.json index d7ec832959b02846feb4424165235803ff19702e..d1d4325ed6e2903e9412220a143cd5c6c46ac690 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.json @@ -199,10 +199,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -263,10 +263,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -391,7 +391,7 @@ 0, 1, 1, - 6, + 1, 6, 6, 6, @@ -765,14 +765,14 @@ 0, 1, 1, - 0, + 1, 5, 5, 1, 1, 5, 5, - 0, + 1, 1, 1, 0, @@ -826,7 +826,7 @@ 0, 1, 1, - 0, + 6, 1, 1, 1, @@ -839,7 +839,7 @@ 1, 1, 1, - 0, + 6, 1, 1, 0, @@ -892,8 +892,8 @@ 1, 6, 6, - 1, - 1, + 0, + 0, 1, 1, 1, @@ -922,6 +922,7 @@ 0, 0, 0, + 6, 0, 0, 0, @@ -950,7 +951,6 @@ 0, 0, 0, - 0, 1, 1, 1, @@ -987,9 +987,9 @@ 0, 0, 0, - 0, - 0, - 0, + 6, + 6, + 6, 0, 0, 0, @@ -997,7 +997,7 @@ 0, 0, 6, - 0, + 6, 6, 0, 0, @@ -1020,16 +1020,16 @@ 1, 1, 6, + 0, 6, 6, 6, - 6, - 6, - 1, - 6, + 3, + 3, 6, 6, 6, + 0, 6, 1, 1, @@ -1051,20 +1051,18 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, 6, - 0, - 0, + 6, 6, 0, 0, + 6, + 6, 0, 0, + 6, + 6, + 6, 0, 0, 0, @@ -1087,8 +1085,10 @@ 0, 0, 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -1149,10 +1149,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -1213,10 +1213,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -1277,10 +1277,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -1955,6 +1955,7 @@ 0, 0, 0, + 1, 0, 0, 0, @@ -1972,23 +1973,22 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -2037,22 +2037,22 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -3149,22 +3149,6 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, 1, 1, 1, @@ -3181,10 +3165,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -3245,10 +3229,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -3309,10 +3293,10 @@ 0, 0, 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -3373,6 +3357,10 @@ 0, 0, 0, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -3998,11 +3986,6 @@ 0, 0, 0, - 1, - 1, - 0, - 0, - 0, 0, 0, 0, @@ -4044,6 +4027,7 @@ 0, 0, 0, + 1, 0, 0, 0, @@ -4069,6 +4053,22 @@ 1, 1, 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 0, 0, 0, @@ -4101,22 +4101,22 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 1, 1, 1, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 265, - "mask_sha256": "fc048834a4597994eeca19f0422bc76865b800ce29e7aa663be439b9b9a6699d", + "known_count": 380, + "mask_sha256": "1da2309fe9749a971a36817a00a24d80150987a7dd5cc17211aa2394ea6d89ba", "skin_file": "H1NZQTDSL8PCF5KD_perfect.png", - "skin_sha256": "dfa84e675457c4f71498aca18dd1fb279e8c6479cb819abbd4b2747907ac9a82", - "meat_revision": "d24adf6272fe036a8341e0a459e1db62718b9ded8e081e1bf117bd6e4846f2ad", + "skin_sha256": "149cbfb73a5e279a6f0b4fbb1fdb8dad9f7ab52f68c1597d5866b1687281f362", + "meat_revision": "db4e3d89fc5b8536f07f407c9f96d538b3a583807eada57bf4a29ba4e37e1c86", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "de5b59e9755f9265b17eef505544955172dcd2c846873b9283af31b5cf8cb906", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.55, - 0.55, - 0.65, - 0.65, - 0.55, - 0.55, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.7, - 0.65, - 0.7, - 0.7, - 0.7, - 0.7, - 0.65, - 0.7, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.7, - 0.0, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.7, - 0.7, - 0.7, - 0.7, - 0.65, - 0.7, - 0.7, - 0.7, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.7, - 0.0, - 0.0, - 0.7, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "valid_sha256": "623ccb86a1ef53003ae0f9cc90a2d77657935e503314340dc9601590c5872211", + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:43:43.164893+00:00", + "assistant_parent_sha256": "b0312704c536c2da1927c2dec452903f2a9a5b7731539d1fd3e9ce545b9aa16e", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "623ccb86a1ef53003ae0f9cc90a2d77657935e503314340dc9601590c5872211" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.png index c995649340a913d187bb688f5612872d3f5c9c9f..50916fa2b10ec8f4ca93ae6d6d34cf4cbb3b0034 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/H1N/H1NZQTDSL8PCF5KD_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc048834a4597994eeca19f0422bc76865b800ce29e7aa663be439b9b9a6699d -size 393 +oid sha256:1da2309fe9749a971a36817a00a24d80150987a7dd5cc17211aa2394ea6d89ba +size 405 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_all_rejected.txt b/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_all_rejected.txt new file mode 100644 index 0000000000000000000000000000000000000000..54d49062cddc1a0e674e543000529e45d6cfdbb1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_all_rejected.txt @@ -0,0 +1 @@ +result_unsatisfied diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_best.txt b/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_best.txt deleted file mode 100644 index 9e2816e88b822c028da6c787e3481bff0792711d..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_best.txt +++ /dev/null @@ -1 +0,0 @@ -N69A8X848R71DHX9_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.png deleted file mode 100644 index 76905b1a2df9dbdb7f2e29129376e78a3b29edbc..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:42ce2b7f629a2b0e4762909bbac51b34ed7af4e3942d8398cbc7f2f9dc867239 -size 5543 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.txt b/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.txt deleted file mode 100644 index 9e2816e88b822c028da6c787e3481bff0792711d..0000000000000000000000000000000000000000 --- a/entropydrop_website_generations/SKING_DDJ_v101c/N69/N69A8X848R71DHX9_perfect.txt +++ /dev/null @@ -1 +0,0 @@ -N69A8X848R71DHX9_result.png diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.json index 64a8d848ecbbf28d4fdefb5b9a6eadebe45a148e..22c718b3af6e5ce482df55d4ae4ca12d8dc0a573 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.json @@ -2,8 +2,8 @@ "schema": "mc-meat-v2", "id": "PNVXFVM545Q8DV5B", "skin_file": "PNVXFVM545Q8DV5B_perfect.png", - "skin_sha256": "0e0f90204f73bfc7a95a28f67c8a1fdbda9a73b42eebbd3718ae1703735f4aec", - "mask_sha256": "f8b3e72ec62c7dc96e77e539216862815641820972355cbfa61972f237e6f3f6", + "skin_sha256": "7e9b7865b94031d6f9571a07d26db03b0dfc724769d421a08862b1dab41de738", + "mask_sha256": "74801a99ac62aecbac9c334d0732a2cb9302b81546999b4f7bd48bbea37a89d6", "model": "classic", "selected": [ 16, @@ -53,6 +53,7 @@ 589, 651, 652, + 655, 711, 712, 713, @@ -135,10 +136,6 @@ 981, 982, 983, - 984, - 985, - 990, - 991, 1072, 1073, 1074, @@ -203,6 +200,7 @@ 3305, 3306, 3307, + 3938, 4000, 4001, 4002, @@ -236,121 +234,21 @@ 4078, 4079 ], - "selected_count": 229, + "selected_count": 227, "encoding": { "meat": 255, "non_meat": 0, "invalid": "RGBA alpha=0; excluded from labels and loss" }, "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "46a6028ad3cab8f64fd9720afa9697b823e75926b41a350a63041d6d01b7a416", - "occluded_count": 10, + "valid_sha256": "c902767506c737bac9231414d058c9e7f748702ababce5e3e6a759e799f5a691", + "occluded_count": 5, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 11, - 2, - 0.65 - ], - [ - 10, - 11, - 2, - 0.65 - ], - [ - 13, - 11, - 2, - 0.65 - ], - [ - 14, - 11, - 2, - 0.65 - ], - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ], - [ - 11, - 14, - 3, - 0.55 - ], - [ - 12, - 14, - 3, - 0.55 - ] - ], - "skin_bounds": [ - 180, - 255, - 125, - 235, - 100, - 215, - 15, - 5 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:52:48.407344+00:00", + "assistance": { + "model_id": "manual-v3-2026-11-01-5a13a215", + "checkpoint_sha256": "76c2c5d0359dfe21bd366465d25dbc86613cf325b2f63675867b5ffcf09e72f5", + "human_saved": true, + "note": "Model suggestions were available; final selection explicitly saved by user." + } } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.png index 204cec486f7ca2541352db1238850f6834cd2ce5..de3180fb534118ee0a2d0395c87c12808777f711 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8b3e72ec62c7dc96e77e539216862815641820972355cbfa61972f237e6f3f6 -size 343 +oid sha256:74801a99ac62aecbac9c334d0732a2cb9302b81546999b4f7bd48bbea37a89d6 +size 300 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_perfect.png index 7fce125a0dfa9a09266be52045158e54025a71bf..bea03ea7608b3f278371a68265178599f3b091aa 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_perfect.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_perfect.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e0f90204f73bfc7a95a28f67c8a1fdbda9a73b42eebbd3718ae1703735f4aec -size 3290 +oid sha256:7e9b7865b94031d6f9571a07d26db03b0dfc724769d421a08862b1dab41de738 +size 3913 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.json index 1bc1414b55da0fb177415caf8370b78dbdf3eabb..a88a061fb577b98a3b0c523fd253c07a07bc5eda 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.json @@ -199,10 +199,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -263,10 +263,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -327,10 +327,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -702,13 +702,13 @@ 0, 0, 0, - 0, - 0, + 5, + 5, 1, 1, - 0, - 0, - 0, + 5, + 5, + 1, 0, 0, 0, @@ -830,12 +830,12 @@ 0, 1, 1, - 2, - 2, 1, 1, - 2, - 2, + 1, + 10, + 1, + 1, 1, 1, 0, @@ -1037,14 +1037,14 @@ 1, 1, 1, - 1, - 1, 0, 0, 0, 0, - 1, - 1, + 0, + 0, + 0, + 0, 0, 0, 0, @@ -3991,7 +3991,7 @@ 0, 0, 0, - 0, + 1, 0, 0, 0, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 229, - "mask_sha256": "7cbf0d0cdd1b571ab41fc57a904f5da1d49b2c57254d87c6ef381bf8f57a6df6", + "known_count": 243, + "mask_sha256": "add4b54d465f65c2516f653836b0ba3b2b4ef1ec8e06d18c139ffc0f879d328f", "skin_file": "PNVXFVM545Q8DV5B_perfect.png", - "skin_sha256": "0e0f90204f73bfc7a95a28f67c8a1fdbda9a73b42eebbd3718ae1703735f4aec", - "meat_revision": "7bb399efe0f9d258b4ae54aa03918aba856216c9239788e8bc153c23ee1fc64c", + "skin_sha256": "7e9b7865b94031d6f9571a07d26db03b0dfc724769d421a08862b1dab41de738", + "meat_revision": "c75296c3545437345d0aecf8753fd40c06e46e6076b420dab6b6a7dc50d18739", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "46a6028ad3cab8f64fd9720afa9697b823e75926b41a350a63041d6d01b7a416", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.55, - 0.55, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "valid_sha256": "c902767506c737bac9231414d058c9e7f748702ababce5e3e6a759e799f5a691", + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:52:48.446598+00:00", + "assistant_parent_sha256": "fe540a2fc25a6e89dcefbcee9e7ce12489150a74a3801da5a3a6efdf9954866d", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "c902767506c737bac9231414d058c9e7f748702ababce5e3e6a759e799f5a691" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.png index 3d0b17654cc84f495dea2b9cedc3bfbebd1b3b67..4109dabd097ebf86e04935ddd2498b611051c5af 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PNV/PNVXFVM545Q8DV5B_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7cbf0d0cdd1b571ab41fc57a904f5da1d49b2c57254d87c6ef381bf8f57a6df6 -size 362 +oid sha256:add4b54d465f65c2516f653836b0ba3b2b4ef1ec8e06d18c139ffc0f879d328f +size 345 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.json b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.json index 4d49869691f3b9aaff1b0286717b1c27dfd080ce..a3ee49980376d1463a9eb8ceb32c5b36d311da3e 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.json @@ -2,8 +2,8 @@ "schema": "mc-meat-v2", "id": "PXX864V98KAEF679", "skin_file": "PXX864V98KAEF679_perfect.png", - "skin_sha256": "c41d4b3bc414a37198ba3fe73f4911e5f258dcadf4c0b11baa60a597f0e0f67e", - "mask_sha256": "bbd06ab31f480809d3061d99016bbce90f25997fb81407e7fc5ca31136c3aaae", + "skin_sha256": "5a1df7a63376fa7ec79ef2ce1f688d511caaa2749a1a2708aa3f00cc3dc53571", + "mask_sha256": "7a2645962d64b7cee168d34f214ae3b41bca7e75a26a851af88a9f6385733c12", "model": "classic", "selected": [ 16, @@ -36,7 +36,6 @@ 404, 405, 406, - 585, 586, 587, 588, @@ -102,8 +101,12 @@ 961, 962, 963, + 964, + 965, 978, 979, + 980, + 981, 982, 983, 984, @@ -175,313 +178,21 @@ 4078, 4079 ], - "selected_count": 168, + "selected_count": 171, "encoding": { "meat": 255, "non_meat": 0, "invalid": "RGBA alpha=0; excluded from labels and loss" }, "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "b4daf7fcd827692ca0d664a41b95d88dffba289036afa04faab1475e79b257c7", - "occluded_count": 8, + "valid_sha256": "263e8cae74343fe247baeaae1b438e7f77dc0e798f7260d663c52c7f8df9f374", + "occluded_count": 0, "complete": true, - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "annotation_source": "assistant_visual_review_20261102", - "human_saved": false, - "binary_training_weight": 0.5, - "evaluation_eligible": false, - "review_notes": [ - "All six UV head faces inspected with source and edited context.", - "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", - "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." - ], - "selection_audit": { - "method": "Per-case visual UV review with region-restricted swatches and explicit face-cell decisions", - "views": [ - "front_left", - "back_left", - "front_right", - "back_right", - "all_UV_faces" - ], - "explicit_uv_decisions": [ - [ - 9, - 12, - 2, - 0.65 - ], - [ - 10, - 12, - 2, - 0.65 - ], - [ - 13, - 12, - 2, - 0.65 - ], - [ - 14, - 12, - 2, - 0.65 - ], - [ - 9, - 11, - 5, - 0.55 - ], - [ - 10, - 11, - 5, - 0.55 - ], - [ - 13, - 11, - 5, - 0.55 - ], - [ - 14, - 11, - 5, - 0.55 - ], - [ - 6, - 13, - 6, - 0.6 - ], - [ - 6, - 14, - 6, - 0.6 - ], - [ - 7, - 14, - 6, - 0.6 - ], - [ - 6, - 15, - 6, - 0.6 - ], - [ - 7, - 15, - 6, - 0.6 - ], - [ - 17, - 13, - 6, - 0.6 - ], - [ - 16, - 14, - 6, - 0.6 - ], - [ - 17, - 14, - 6, - 0.6 - ], - [ - 16, - 15, - 6, - 0.6 - ], - [ - 17, - 15, - 6, - 0.6 - ], - [ - 11, - 13, - 6, - 0.6 - ], - [ - 12, - 13, - 6, - 0.6 - ], - [ - 8, - 14, - 6, - 0.6 - ], - [ - 10, - 14, - 6, - 0.6 - ], - [ - 13, - 14, - 6, - 0.6 - ], - [ - 15, - 14, - 6, - 0.6 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ], - [ - 11, - 13, - 10, - 0.5 - ], - [ - 12, - 13, - 10, - 0.5 - ], - [ - 11, - 14, - 3, - 0.55 - ], - [ - 12, - 14, - 3, - 0.55 - ], - [ - 8, - 15, - 6, - 0.6 - ], - [ - 9, - 15, - 6, - 0.6 - ], - [ - 10, - 15, - 6, - 0.6 - ], - [ - 11, - 15, - 6, - 0.6 - ], - [ - 12, - 15, - 6, - 0.6 - ], - [ - 13, - 15, - 6, - 0.6 - ], - [ - 14, - 15, - 6, - 0.6 - ], - [ - 15, - 15, - 6, - 0.6 - ] - ], - "skin_bounds": [ - 70, - 190, - 30, - 135, - 10, - 110, - 20, - 8 - ], - "no_prediction_used_as_ground_truth": true - }, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "review_pass": "rare_boundary_v13" + "updated_at": "2026-11-02T12:55:57.375177+00:00", + "assistance": { + "model_id": "manual-v3-2026-11-01-5a13a215", + "checkpoint_sha256": "76c2c5d0359dfe21bd366465d25dbc86613cf325b2f63675867b5ffcf09e72f5", + "human_saved": true, + "note": "Model suggestions were available; final selection explicitly saved by user." + } } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.png b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.png index e9aa8f2a34e21e7eb51bdd03dada210d7b60a6b1..31772532a45e0a6329a51380932f4f23bdd1998f 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_meat.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbd06ab31f480809d3061d99016bbce90f25997fb81407e7fc5ca31136c3aaae -size 352 +oid sha256:7a2645962d64b7cee168d34f214ae3b41bca7e75a26a851af88a9f6385733c12 +size 312 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_perfect.png b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_perfect.png index 05ffd58c3819b50e87d55b06386da578ae4484c0..014a4fee859e0602e9e6edf18429055727e650ed 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_perfect.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_perfect.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c41d4b3bc414a37198ba3fe73f4911e5f258dcadf4c0b11baa60a597f0e0f67e -size 3304 +oid sha256:5a1df7a63376fa7ec79ef2ce1f688d511caaa2749a1a2708aa3f00cc3dc53571 +size 3624 diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.json b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.json index 8dd5b65b3626bc8857f27a0e29ce03dd5b443b33..cdf14babf5e426c284150aafd50ca51231883f2b 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.json +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.json @@ -199,10 +199,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -263,10 +263,10 @@ 0, 1, 1, - 0, - 0, - 0, - 0, + 6, + 6, + 6, + 6, 1, 1, 0, @@ -638,7 +638,7 @@ 0, 0, 0, - 1, + 0, 1, 1, 1, @@ -826,7 +826,7 @@ 0, 1, 1, - 0, + 6, 1, 1, 1, @@ -839,7 +839,7 @@ 1, 1, 1, - 0, + 6, 1, 1, 0, @@ -1017,8 +1017,8 @@ 1, 1, 1, - 0, - 0, + 1, + 1, 6, 6, 6, @@ -1033,8 +1033,8 @@ 6, 1, 1, - 0, - 0, + 1, + 1, 1, 1, 1, @@ -4150,8223 +4150,35 @@ 0, 0 ], - "known_count": 218, - "mask_sha256": "b1e831957489e78a3d7d9c216cc2449e11a829fbc61e1931a52a479daf480d46", + "known_count": 231, + "mask_sha256": "7c5358137654f4cd3e31c57270c60f2e504b1307255853e33ad5d8d7cc5dfff4", "skin_file": "PXX864V98KAEF679_perfect.png", - "skin_sha256": "c41d4b3bc414a37198ba3fe73f4911e5f258dcadf4c0b11baa60a597f0e0f67e", - "meat_revision": "826dfc54a8986c38591e08b1127d5d5c14ee2c3a5bfdc27425ca8bb2dbda0019", + "skin_sha256": "5a1df7a63376fa7ec79ef2ce1f688d511caaa2749a1a2708aa3f00cc3dc53571", + "meat_revision": "075b963388007cb38280ca827c6b8db347178009ed3dead4c1a149a04660fd07", "visibility_policy": "same-part-face-orthographic-full-opaque-v1", - "valid_sha256": "b4daf7fcd827692ca0d664a41b95d88dffba289036afa04faab1475e79b257c7", - "human_saved": false, - "annotation_source": "assistant_visual_review_20261102", - "fine_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.55, - 0.55, - 0.65, - 0.65, - 0.55, - 0.55, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.6, - 0.55, - 0.55, - 0.6, - 0.65, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.6, - 0.65, - 0.65, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], + "valid_sha256": "263e8cae74343fe247baeaae1b438e7f77dc0e798f7260d663c52c7f8df9f374", + "human_saved": true, + "annotation_source": "human_reviewed", + "unified_annotation": true, + "partial": false, + "unknown_class": 0, + "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", + "updated_at": "2026-11-02T12:55:57.414527+00:00", + "assistant_parent_sha256": "2d0055daafa23ce4de21e0e2014f7c1c0d615bcd1a5a396ca66dfef8ca8e383c", "review_notes": [ "All six UV head faces inspected with source and edited context.", "Only explicit depicted nose/snout retained; flat central face and moustache are not nose.", "Fine negatives only cover inspected non-meat head regions; unknown cells remain ignored." ], - "partial": true, - "unknown_class": 0, - "encoding": "RGBA class IDs 1,2,3,5,6,9,10; valid unknown=0; alpha=0 ignore", - "updated_at": "2026-11-02T04:48:38.617114+00:00", - "fine_review_complete": false, - "reviewed_class_ids": [], - "evaluation_eligible": false, - "review_batch_sha256": "0fb5d75ee429884ad9a720707799fa5061985ce43948ba335ba883086da8977a", - "fine_negative_weights": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.65, - 0.65, - 0.65, - 0.65, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 + "fine_review_complete": true, + "reviewed_class_ids": [ + 1, + 2, + 3, + 5, + 6, + 9, + 10 ], - "review_pass": "rare_boundary_v13" + "reviewed_valid_sha256": "263e8cae74343fe247baeaae1b438e7f77dc0e798f7260d663c52c7f8df9f374" } diff --git a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.png b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.png index 6c3af9e9fc09b2cab5c8ed813ba7f85f4caeb2f8..18d8e157662a5d47fbded2e41717f5f88725e2c5 100644 --- a/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.png +++ b/entropydrop_website_generations/SKING_DDJ_v101c/PXX/PXX864V98KAEF679_semantic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1e831957489e78a3d7d9c216cc2449e11a829fbc61e1931a52a479daf480d46 -size 399 +oid sha256:7c5358137654f4cd3e31c57270c60f2e504b1307255853e33ad5d8d7cc5dfff4 +size 348 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/13P/13PTZMFQWXN3JRL1_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/13P/13PTZMFQWXN3JRL1_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..0434b0bf16b6220734710fa6a552b46c5002691e --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/13P/13PTZMFQWXN3JRL1_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d25646b321c296e39df1527a2ce1b94dd071d30818ab19a7dd0dc946e9803d29 +size 4831 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/15Q/15QL2MDQB2AJYZ2B_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/15Q/15QL2MDQB2AJYZ2B_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ece5a38e0237396442db3a6c0f9cb95cbbc9196f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/15Q/15QL2MDQB2AJYZ2B_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5182c37672390c3636e0b7d6f20046c86d671e5e0ec4d3efba02788a3ff29018 +size 5158 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/17U/17U8ZVRWNETUFZAX_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/17U/17U8ZVRWNETUFZAX_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9143a96e1511739d7c2b2b2ad01a93941555bc50 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/17U/17U8ZVRWNETUFZAX_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:751e2670281664f41399468fb830e2994e9c89b8cb9cad0760c2f49cd51793e3 +size 4008 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/189/1897D1MKQ63RK458_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/189/1897D1MKQ63RK458_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7cddaaa5d522a0f86888fc6ee3531086615f04e6 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/189/1897D1MKQ63RK458_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4584e617b37e4a8beea4c0ac22a0d7beb184f09f2b65c55b6997ebb4610e408 +size 5088 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/19C/19CLC1CJLH6CRG7H_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/19C/19CLC1CJLH6CRG7H_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..167986a2965cc992e8bfbdc2a481dae33e4d48ca --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/19C/19CLC1CJLH6CRG7H_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4be62e1d8a2bd23e1dee9440f45e596ed0cdc9f3552e0a0176a627d05da252bb +size 4868 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/19G/19GUSYTDK497T7UV_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/19G/19GUSYTDK497T7UV_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..48a43d725e7108bf17e7ba11c7d4fc96300a85fe --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/19G/19GUSYTDK497T7UV_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bec10a9c3fcea4d4ae723981cea84c0f4ff8fd45a44a42374a149328fec168f2 +size 4710 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1AG/1AGTRPP39F8BKQ6E_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1AG/1AGTRPP39F8BKQ6E_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5dd52c0ab74c1f3ec3ed4e122097ae850a9a97f4 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1AG/1AGTRPP39F8BKQ6E_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5c35d990d3792420de888ac0e70d1a5072e8b10901e5053b2e5b775ac00d899 +size 4363 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1FP/1FPZQAAA9D729PYQ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1FP/1FPZQAAA9D729PYQ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..3b32806935dde48786d50c4945b0ca5eda25e5ab --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1FP/1FPZQAAA9D729PYQ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0713710bf0b0426b0edaca24e8bd1fe5a72f71bd31d9c9818fedb316a8833412 +size 3614 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1H6/1H6GAQA9BENWNB89_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1H6/1H6GAQA9BENWNB89_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..348ae27db01c1a605db31211ded8bb0955c6850a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1H6/1H6GAQA9BENWNB89_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40cffaac59ad7a2023092492e787f97ccc26757377af4c11112567969d3dcd6b +size 3750 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1ND/1NDLYUS5XSM5KKW1_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1ND/1NDLYUS5XSM5KKW1_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a8dbea7622cbfe1f67ec54391477241ee91cdc39 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1ND/1NDLYUS5XSM5KKW1_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eeb9abcb2e5ee41ef7ae56b2ad02630bd4c407aac1acc6561cae8103cc780630 +size 4155 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1NX/1NX9E3NB64QA6XD2_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1NX/1NX9E3NB64QA6XD2_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..381a07077e75d3f4590618c4c208c304cd5334ed --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1NX/1NX9E3NB64QA6XD2_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c38b8c4174ef50e3cda82cac222fd4e3d6232cb62b7ff5b215c128fe8a2e40f +size 6865 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1QW/1QWEVMY3VLAP654D_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1QW/1QWEVMY3VLAP654D_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..e7bc5086f68dbee187ddc67c1d435185cb3a0a20 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1QW/1QWEVMY3VLAP654D_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d6f1631914cc6dcdb2a99d0b744148ff2a7461d6431b20c77feaba9e562a623 +size 3189 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1RE/1RE1SA1RYR1YCYPG_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1RE/1RE1SA1RYR1YCYPG_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c20df5151c94b3609c32d370908e52b00847b1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1RE/1RE1SA1RYR1YCYPG_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81e9bfc040fdf110f78c1dd2be106e56c33893d83e0bd729a635ca35d1bc8124 +size 4816 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1RV/1RVLUW7KNDTC639T_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1RV/1RVLUW7KNDTC639T_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..30da94e8db1bd22f7df0dcfeabde1e97c357af5c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1RV/1RVLUW7KNDTC639T_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a2af3b50e4416a9cb3a4bdb2c8e259df8cac60169d568b61df3cedc982c1295 +size 3328 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1VF/1VF9ABSHPAN5JGNY_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1VF/1VF9ABSHPAN5JGNY_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..2194375b47b5dc5007f0a9985a1ddd40b6c87790 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1VF/1VF9ABSHPAN5JGNY_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24a5a47fae49aebeca668181597371ee4d4e7fe5964235e35328735818459daf +size 6704 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/1YM/1YMBXJKXADJUNM4X_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/1YM/1YMBXJKXADJUNM4X_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..8c174ccab235b3cb2a263207866081c3b24318c6 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/1YM/1YMBXJKXADJUNM4X_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af542c6fe07ba90f22af802a4806e70f60a194f05b692a02dedb9c740ab7450d +size 4836 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/22C/22C4DR35JX73HXBZ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/22C/22C4DR35JX73HXBZ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..4dd5683aee34ce4bcd922b1f08c602e1f77c29ad --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/22C/22C4DR35JX73HXBZ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9300efff2a5d0613662c12a0d9ebb7868dd98968a147af959cdb8f2f9173ff8 +size 5051 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/22F/22FR9792XL8GXKNM_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/22F/22FR9792XL8GXKNM_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..6cf41183a6005501643d77e4c99dd60b0f6ee4ef --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/22F/22FR9792XL8GXKNM_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e1cc8c9c66381873b8f307db56be548bfab4dc9aa8c7ca3b2f75c84eb5b484f +size 4133 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/23A/23A4FUKKY8X3U61R_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/23A/23A4FUKKY8X3U61R_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..f927d5b61f82cad088cf969e9d499584d4cf4c33 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/23A/23A4FUKKY8X3U61R_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51081b15221b8c02e142356a9dfed094444943b0a84d7458dc885c1d9baeeba8 +size 6700 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/24V/24V9W94BLVLQ9GUW_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/24V/24V9W94BLVLQ9GUW_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..4e2617ccd56ebaa94e33719e1435e2a981460d0e --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/24V/24V9W94BLVLQ9GUW_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70bf129e40ab4462d41b138b03b17bd665002875d54e5f3e9a8e7680bc2b40b7 +size 5038 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/254/254NJBPVUEM759NA_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/254/254NJBPVUEM759NA_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..470b1b677e0c9d27493808a1800cbd59aa1e7c59 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/254/254NJBPVUEM759NA_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14fdf7183bb3c7fc7bdc7f1a8d3e0b2757f57658f92a78c97959fe7dbdabcc60 +size 4373 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/268/2684F5GHXCMHEDJE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/268/2684F5GHXCMHEDJE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..3b803300730d49d33b9dc20b473f599a07946d28 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/268/2684F5GHXCMHEDJE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef4dfe6712a57f076f872a866d61e5885f989ae83f10adf477a1b12e6bd07b49 +size 4454 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/26G/26GCDD7JXPRMDZAA_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/26G/26GCDD7JXPRMDZAA_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ec0102f7cb79fcd61441cfb113bf7b5f1a9309cd --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/26G/26GCDD7JXPRMDZAA_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48273cc2b14f01f2ba3b14e541aa7c4a66e622f08046416e376509a455a43dec +size 6549 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/26X/26XQJ1YEEP12NSHC_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/26X/26XQJ1YEEP12NSHC_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..04fdf53d8a9c276fcc8b814c31334b2bdd4d74f5 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/26X/26XQJ1YEEP12NSHC_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d98cde2a8dc3bebbb04e9badb8f1e16312891f1ec7ead633c0bd70e431c539df +size 3655 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2HV/2HVV486WLYGNJ1KN_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2HV/2HVV486WLYGNJ1KN_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..dd278c277ed9cc2ba2b36bbbb55582e9838289dd --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2HV/2HVV486WLYGNJ1KN_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea8e7e956e884e8f3a4850a2c38020c6f0772e6d29b488763f3504273d780663 +size 3234 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2J7/2J72TZQMYG4JPBR1_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2J7/2J72TZQMYG4JPBR1_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..741478ee41690135e82656a578b360251fd44f45 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2J7/2J72TZQMYG4JPBR1_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0f3aa6390ed79e82e396cf59e0e216304764c4b949922225f46c1de59b2a928 +size 4112 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2JU/2JUVKZ7MYMAVEHLN_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2JU/2JUVKZ7MYMAVEHLN_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..4325a3f6a64bcf71df6f480c69f406cb453e1e32 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2JU/2JUVKZ7MYMAVEHLN_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8170fb33a0e996d6fbac36fe7f7dfcd5feab8cf618193c0da8bbe083e891017 +size 3793 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2L4/2L4DPU434KNC82YY_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2L4/2L4DPU434KNC82YY_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..78425a05acf88b228da64faf28491ee12dd3e4e4 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2L4/2L4DPU434KNC82YY_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76c0a43629d3f690c4d3f8d5063edb086c2a75be38baf0cfd4b31ae5ab729f7e +size 3775 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2QM/2QMT4SWXGU3GYSNG_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2QM/2QMT4SWXGU3GYSNG_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9712ffc3e8706009da9116e07f605ad35d523de0 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2QM/2QMT4SWXGU3GYSNG_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6d20d6e04feee80d47a24f17f9b9009563a45de0fb975cab36702efa7e5e71f +size 3871 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/2WN/2WNF9P74P5R78Y7L_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/2WN/2WNF9P74P5R78Y7L_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..4918ffd26d85b6a71c111cfccad65e2cebd99527 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/2WN/2WNF9P74P5R78Y7L_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd0e522c5d85965ff5b961b1b89148e2de1ed77496e7f19e8767db2907fd0c13 +size 4453 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/33U/33UQ4CRFVVZNYMXE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/33U/33UQ4CRFVVZNYMXE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..6780eee7c494a9e8ee5f8dcd91bceb9e51c54486 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/33U/33UQ4CRFVVZNYMXE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd108221abdd9355b93e7b9c5d698932b1318b5844a45c9e6da9fa1b9cd0617c +size 5137 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/34G/34GEYMDA2JEYKS5R_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/34G/34GEYMDA2JEYKS5R_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7e4434ee4a8b1e52765c1f6ae7becb39a364f121 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/34G/34GEYMDA2JEYKS5R_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de72439250be1f64216ccffbc70fd2457a25064d28098ada12b72b5d3705a8c9 +size 4378 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/35B/35B44C86VH87U22V_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/35B/35B44C86VH87U22V_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..3bc14211b921ce57b025a9146daf96314134eb8b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/35B/35B44C86VH87U22V_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28bc01f689b3bbe24bf62e144a1df2f2e07d2644e6a69c9f7b7854125988124f +size 3316 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3A8/3A8BVLA861451EFU_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3A8/3A8BVLA861451EFU_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..996c9b0f0cc5fce46bbf4b9e5a8f209d6aa6b476 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3A8/3A8BVLA861451EFU_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c852c01605f1f357a35126b204059584f17d8f3a8db1dcae8306e4aee77a954b +size 5274 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3C2/3C2XDAC2PPNY7VED_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3C2/3C2XDAC2PPNY7VED_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7cb92516c851c6961c8fa15ba4c101cd18d1f59b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3C2/3C2XDAC2PPNY7VED_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0b1005bc7ee65f5a3eda034a0f166057d9cf91c0b2f51f9bae86ce66ef84f04 +size 3026 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3CV/3CV48MKBQ6TNF6QP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3CV/3CV48MKBQ6TNF6QP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..598e88b1bc84a48146654ee62c8c5d168b19d710 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3CV/3CV48MKBQ6TNF6QP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09fea619523037948e1987a30725acf7db5b3ec310a1bb75d80b2b59883a2e4a +size 6965 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3JP/3JPRA2SYG6QYQYME_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3JP/3JPRA2SYG6QYQYME_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..250d46c30af4faf353aaaf9c28c9bfbc60615bcc --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3JP/3JPRA2SYG6QYQYME_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5420de5e0d8da2e40f2a281c6003ae57018c7f4bd6bbfb4324e3e40e631b4c60 +size 3837 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3MQ/3MQMB1LVUCVQ23SB_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3MQ/3MQMB1LVUCVQ23SB_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..76ebb5c55871296a5fbad1b47ef1aa4a6ba5d444 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3MQ/3MQMB1LVUCVQ23SB_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f786511ea0ffe16d5a88e80c1e799a8d13d6faf2cb7b8142229c9d080f3d44e6 +size 6561 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3NT/3NTEEKGZA31WWP48_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3NT/3NTEEKGZA31WWP48_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..aee806ff277e0484b099fc3ce499920a02c886af --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3NT/3NTEEKGZA31WWP48_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61ae3284b35a4b4170ecc8f990184d676f533a0fe2fc597317507a5466c03586 +size 4698 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3QY/3QYBT3BCE5NR6HAP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3QY/3QYBT3BCE5NR6HAP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5a431884b85049f4fd98e737584f04f8e99750d9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3QY/3QYBT3BCE5NR6HAP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7b5a9b5775f091c6bb11dcaefafc8a1c31385115c149cd63482039c97d3d00b +size 4699 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3TT/3TT81UUHQF5L4FCN_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3TT/3TT81UUHQF5L4FCN_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ca1cf822af80a9530cc7ead4edb06eb16b5792bb --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3TT/3TT81UUHQF5L4FCN_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db9e617307af9e46adb59acbcb2d213ecac03e1dc60460d024172984194ea773 +size 3897 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3UW/3UWAGELEX26LLX3L_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3UW/3UWAGELEX26LLX3L_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..d2d0353de941dcb640c2e5c79322beec0548b95e --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3UW/3UWAGELEX26LLX3L_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:313162ea6a9bffced864b680153159ff1505a4a9089592e0707e03f5bfd20089 +size 4469 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/3X7/3X7888DRG3F1E55L_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/3X7/3X7888DRG3F1E55L_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..d4095e4884008b4dcd8c97e599730df054d9a27f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/3X7/3X7888DRG3F1E55L_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5ec973826715eed1e3c528d38db32499f40d72b34d951f409dabac2ec204555 +size 3470 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/41A/41AWCT17T84Q485Y_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/41A/41AWCT17T84Q485Y_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..d25e0d8b24defa3399dee6189bb2a6ab26dbfeb9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/41A/41AWCT17T84Q485Y_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0df2961411b4dbbef32e7639cc340af1c0a3930ad57190adc3b5819a39fcc8e1 +size 3595 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/41Q/41QZRM1NPRE3Y9QR_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/41Q/41QZRM1NPRE3Y9QR_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c544559916b9c50deecf2a91993270d475dd0d95 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/41Q/41QZRM1NPRE3Y9QR_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea891958414f880cdcc34985eff61cfc0ef19b0f109ad64008ef0f1564911dd6 +size 4757 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/43Z/43ZFEBPKFPSHL8RX_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/43Z/43ZFEBPKFPSHL8RX_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..0e0f22618c746062e772f33231159359f758b6b1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/43Z/43ZFEBPKFPSHL8RX_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecb1c8b59e6f86f1023c3b79e315c612e34dbccb742c1366912a03270e6dcdd9 +size 3418 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/457/457CK9Y94GFVJFHH_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/457/457CK9Y94GFVJFHH_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9e872b4419d62e4b07b37078a2e33bac9e540c2b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/457/457CK9Y94GFVJFHH_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93912c952d8b730a4c1a56f936b9116af0e0ff967bf4ded2a30a29654a75db39 +size 4460 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/45N/45N1PYY86QVER4AV_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/45N/45N1PYY86QVER4AV_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9236694788f6f8065264f6cf00f841847a870f03 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/45N/45N1PYY86QVER4AV_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bcd4167ea44e3798cea6bfb7cde9fa9abe3b5191eceef1d22c90dcacecb5446 +size 4277 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/45N/45NN294T848RH5TT_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/45N/45NN294T848RH5TT_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..15a3d48bf91a093dc4014283dacb96b01045d6ed --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/45N/45NN294T848RH5TT_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dedb826145fc75cb9cf24b0ce2b16745aaf66f49c0609b8dcadab0e30a12e2b8 +size 2814 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/48R/48RACKPX8YVWJDKG_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/48R/48RACKPX8YVWJDKG_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ab8f8b39dc893019da7049934f6d3b7d38c64adb --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/48R/48RACKPX8YVWJDKG_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f84a7af27803ca7fea7cb873b0ee66032e0e2a3f639cf3068cd7660ce95ed02b +size 4366 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/48S/48S6SPPG9VPBN5MQ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/48S/48S6SPPG9VPBN5MQ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a7b6224ce07bb9367b24cd327f99e5355267f260 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/48S/48S6SPPG9VPBN5MQ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:554567d8c8045a796b33cf9cc23fbba39f2422969150d17de07ce4bf4cc29c08 +size 4503 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4AH/4AHNT1CCGLX6ALHR_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4AH/4AHNT1CCGLX6ALHR_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..defb3c36c879bbb3493e8540718ad9a617f93c80 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4AH/4AHNT1CCGLX6ALHR_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54b5a985b81d6ad24f40dfd131a02d6ff25a3e9f9fb3f2fbb1d89a381e3bfa06 +size 3434 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4C6/4C67XSKN8ARHE478_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4C6/4C67XSKN8ARHE478_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..43910b03774e505ba5f5fc2093f1538dd1db39d2 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4C6/4C67XSKN8ARHE478_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93c4f1fe3598a44b6b8de51304de9d2913e5ff66a1be512f553eba5bb0b08341 +size 3259 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4CD/4CD9WUNEM3MCAX9S_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4CD/4CD9WUNEM3MCAX9S_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..946c42b38b37dd8b300fa46d22f3394b65f2e76c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4CD/4CD9WUNEM3MCAX9S_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6c15841b2fb0cc7c2c28a687ab9c176354ff022808f4c45a052a68c3af52db9 +size 4613 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4FR/4FRDAB9QZTPL7Y7X_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4FR/4FRDAB9QZTPL7Y7X_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c23d8bde67af538c45effd90d9fa189d48b6b212 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4FR/4FRDAB9QZTPL7Y7X_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73145763b52a7ef39a72093dab185a3914edd4a2b79a91d4e000b6186bd188de +size 4669 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4GQ/4GQ7CEEYKYJ647Z1_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4GQ/4GQ7CEEYKYJ647Z1_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..f18743ff764c5234618533c5dff3ee6613ea9c30 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4GQ/4GQ7CEEYKYJ647Z1_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab1f2dd50016b465c591c26807f56a2516dfaf472b81e72a0d0f06a47010d79f +size 5456 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4LU/4LU4WL2W568UFX5G_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4LU/4LU4WL2W568UFX5G_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..0e0489a9913350623312f6eea38879fdfe20bd94 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4LU/4LU4WL2W568UFX5G_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:707c8ebf70bffdb875d0fdac52950bb1ba274be722752ee4900bed648111613b +size 5157 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4PJ/4PJLKJGPDNEUSKPE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4PJ/4PJLKJGPDNEUSKPE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ab14644a5d61f1a1835967b04a41836a384ad2fb --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4PJ/4PJLKJGPDNEUSKPE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1269bc0b755c3804e1a6872ea0bfb330fac2ba462e31f8e6ce586bbcc226c2e +size 5733 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4RA/4RA3YYF6S15A7JLS_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4RA/4RA3YYF6S15A7JLS_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..6d7eb4a13fd0ff1228d0446fcd94cb135b9dcf35 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4RA/4RA3YYF6S15A7JLS_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c2a43c1f88740b99319dd665b358b9a59a4fc23998cf016b29994cd5b117a93 +size 5246 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4Y1/4Y1TYAFDGRUXRYVP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4Y1/4Y1TYAFDGRUXRYVP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..aee806ff277e0484b099fc3ce499920a02c886af --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4Y1/4Y1TYAFDGRUXRYVP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61ae3284b35a4b4170ecc8f990184d676f533a0fe2fc597317507a5466c03586 +size 4698 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/4ZV/4ZVTCXVRWTB9ZW4A_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/4ZV/4ZVTCXVRWTB9ZW4A_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..39d230b07c515e8d9db66d3cdebe3daa11c2d14f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/4ZV/4ZVTCXVRWTB9ZW4A_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9343ffe3ffc504d6a38318afda3415fd78f5d26a804dba41e9a15c456f2109db +size 3781 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/521/521S8JH1BSCSU8TX_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/521/521S8JH1BSCSU8TX_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..be4740805d363c81a32afbc84047a20e2a9e4a4b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/521/521S8JH1BSCSU8TX_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e96f8d940b1207833c948eef6837767bb0b786a0d24a060c6884e78b345dcdf7 +size 4202 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/54V/54VWYCUX7PKRX4FP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/54V/54VWYCUX7PKRX4FP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c6779dc1a75dd923877b7e87165e8b689fdf1cfb --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/54V/54VWYCUX7PKRX4FP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b2fc63b5ccee3c4f9e7d7e86283079f966f062b9fa4e646da7b3d202621e2f2 +size 3516 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/55K/55KHJEGPL1G4UMKT_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/55K/55KHJEGPL1G4UMKT_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..50724292b1b9b939c1712f87fe57c1379006fcd7 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/55K/55KHJEGPL1G4UMKT_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:610301a280c309ca7de0c0aa320f476cc292fd674a77af6a5790073bfd7d53b2 +size 5050 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/55Y/55Y6WECCWZS7UA45_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/55Y/55Y6WECCWZS7UA45_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..82b796e4f4252d94bb607416d0965968cc68c702 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/55Y/55Y6WECCWZS7UA45_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a15cd3dc7db035071df306c29955a403361525ec217d4137c85117ff6f4f69bc +size 4622 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/562/562QYDMUHP6Y89MM_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/562/562QYDMUHP6Y89MM_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..4b80fcafeb95410d40b5e0c1b0987438f5bcb617 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/562/562QYDMUHP6Y89MM_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50dec234361c8556853c8e754255835a70a8ed2221d580704d787d0cd80fc474 +size 4599 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/59M/59MCSHF99GE21H39_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/59M/59MCSHF99GE21H39_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a01d1bbd0f03179963bccedf3e718dd8885884c8 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/59M/59MCSHF99GE21H39_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46e1c14fdf89241c638551f6d2463a88ccf58272286f29d97daf0fbbeecb9aeb +size 4113 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5D7/5D74V6D8LDF3ME42_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5D7/5D74V6D8LDF3ME42_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..35fbdcc5f3476f2d7cea1c477fe6762d34e4e022 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5D7/5D74V6D8LDF3ME42_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03cca263ad2a30bcf89154e3aade4baaba0e4eca816cd1cb8239d3dcbe5c2733 +size 5125 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5E2/5E29RAMRJEQLL3R9_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5E2/5E29RAMRJEQLL3R9_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..32f32e324d8f5aecf1f44440d1bbb7b44f0b6d46 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5E2/5E29RAMRJEQLL3R9_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a18a93e20b11ca080e8a308a3769cef6ee5aca47ca81d0ff93b1108730e94f5 +size 3679 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5FB/5FBF9ZAY9KE4R5H3_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5FB/5FBF9ZAY9KE4R5H3_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ead5818e0af6592a9493db5584762e7a0ab75dd8 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5FB/5FBF9ZAY9KE4R5H3_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3debe0e553f789ce453be6642cb4cd6a0c429ebd538ca65990e6f9f1558edb7 +size 4412 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5H8/5H8BTCSXUMMT1J23_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5H8/5H8BTCSXUMMT1J23_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9e3093188ac16a6e29352471fda6b8f90ebd228b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5H8/5H8BTCSXUMMT1J23_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b82684248d2f3c5399300b9ba0bea7135c7ab949889f9a3afc8812d5e5de673d +size 6139 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5K5/5K531RLGTMZ6FVZJ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5K5/5K531RLGTMZ6FVZJ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..0fd648c11e70268d7a6b6d68f0511dd50d2f3dc0 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5K5/5K531RLGTMZ6FVZJ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:710565ee7fdfe5a5b54ee2b989b5c191a6dae3230dd7405792d31a3169bf6567 +size 3213 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5QA/5QAKL3MQQQ59QXRD_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5QA/5QAKL3MQQQ59QXRD_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..05211e984d5d97ec3657aeb600316bb541b8f810 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5QA/5QAKL3MQQQ59QXRD_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:947222b8249183d13de680bf0a35dfa216dff6032f8785412ef858dbc0a38953 +size 4047 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5V8/5V85Y81Y5UQMBW8V_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5V8/5V85Y81Y5UQMBW8V_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..09b853fdf1f3745e1bf8f1d88cda4f4617d4257f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5V8/5V85Y81Y5UQMBW8V_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68cf4739fc36b4123088106283e287a7317150a102b73693fc2a76132b073738 +size 4375 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5VD/5VDVHMCG5BTJDAXR_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5VD/5VDVHMCG5BTJDAXR_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..83ef441be2f28bd494d506e78eaf6c63077173e2 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5VD/5VDVHMCG5BTJDAXR_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1988601f15160eb966577c19a8185886844434ceca6609334eb66d8b8ad183c6 +size 3040 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5VX/5VXN2A84UJG326KZ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5VX/5VXN2A84UJG326KZ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9011c314df1dd56ea0299c04f1e54fbc42731394 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5VX/5VXN2A84UJG326KZ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:464ba6ac03696d135b619a7630102290902ea4ef14ecf6d3b679730707951058 +size 3618 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5XX/5XXBSED6RKEPLTQH_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5XX/5XXBSED6RKEPLTQH_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..82c4459f840233781d2f8b6127b8ee6e4171adc6 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5XX/5XXBSED6RKEPLTQH_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55b0f8375b94fac82d5f144a9bf85157fa51a26707855ae6a2345081f7da0ed0 +size 3491 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/5YX/5YXQPC6ZA2DXSBTE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/5YX/5YXQPC6ZA2DXSBTE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5990ee545b2c8cd45946a745bbbdb34c7308d89f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/5YX/5YXQPC6ZA2DXSBTE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc1dc4c7472c72b2653e9265806d3ef6c09f4de46f8b9c308890d7660eab9028 +size 2801 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/61Q/61QY7DN6T55FW8XF_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/61Q/61QY7DN6T55FW8XF_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..36e735b97768c55d749e5aed5b238f29c68f5d91 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/61Q/61QY7DN6T55FW8XF_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcad5d1a89978936ec177f7d17c954539754a7b88953262e710982cfea6ebdff +size 5207 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/62L/62LS53Y5Q1DWGKQY_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/62L/62LS53Y5Q1DWGKQY_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..df3f308285f343d01003a12034c01d0e115b5b94 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/62L/62LS53Y5Q1DWGKQY_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56de572ea6e0817b35c8f8c69cf1403b29106008cf333dfbf0f950d064433745 +size 3730 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/62V/62VJE8HRYRYRD2GF_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/62V/62VJE8HRYRYRD2GF_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..79c2deedefdb79f00c9e25b701bb99290150fcaf --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/62V/62VJE8HRYRYRD2GF_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19020735eb51a3f45430ed42c7f784231281b6186825d59eebbfa74ae608358e +size 4808 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/675/675QLXBFXWU6U9MB_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/675/675QLXBFXWU6U9MB_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..335ddf8fb0c13cfa121472a53df32506265b3027 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/675/675QLXBFXWU6U9MB_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7186346d132ddef282f010dc0bcc0d75a0b436c40e1b76064f454de59d94338e +size 2722 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/69B/69BAXTC69PB3Y5EY_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/69B/69BAXTC69PB3Y5EY_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9636beef81734b282dc4c129cced6d5b0ed2833b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/69B/69BAXTC69PB3Y5EY_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd4eb686a47cf5669fcb1565450e5e67cb1312d268e7274f03bce92a6ce11315 +size 6456 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6AJ/6AJAYGKDYS9DZM1X_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6AJ/6AJAYGKDYS9DZM1X_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..1ab0e09a58d8e543df3986118f42cfc4e527f2b9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6AJ/6AJAYGKDYS9DZM1X_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20f7c9c23b5f66d8293adb0e7922bca3db9f7dc98c0f8d8671b61867d54f0e1e +size 4859 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6AY/6AYV58KJUYPV778L_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6AY/6AYV58KJUYPV778L_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..0753b6747bbc438dab3e150e839b46097237d56d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6AY/6AYV58KJUYPV778L_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f81757739542fddb370b779ab27a44c543e300fd02d12b6c8ed9dd30e30f8c11 +size 4112 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6BB/6BBLVXLRQVUGGAGQ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6BB/6BBLVXLRQVUGGAGQ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..407df419dd8191957324b05a611ac9b3ed5cf213 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6BB/6BBLVXLRQVUGGAGQ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75f623be0bf425d728cad2ae82cb9f83b93755d573f70d1e100eaf9d3944243a +size 4243 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6BZ/6BZ6LR98BU2K8ZWC_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6BZ/6BZ6LR98BU2K8ZWC_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9e050ce7fd2046eaf11d1a0542c962735915706b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6BZ/6BZ6LR98BU2K8ZWC_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f12a539c20b603ede25fa0d74fed49b701d148eb2711f92bac59d65b923f7bfe +size 3287 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6KB/6KBACLVXP7ZG9G86_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6KB/6KBACLVXP7ZG9G86_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..cd2b482116b509bcb7cda271d1ea077fc3865df4 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6KB/6KBACLVXP7ZG9G86_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b32ad48ca48670336b35e661e9b3a20d6918bef701f7c3df48fa6964f9ca2b94 +size 4563 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6KT/6KTB5RH4GX1UUBZU_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6KT/6KTB5RH4GX1UUBZU_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5f7601822b4730ec63f71c13f49ca33e605ab4a6 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6KT/6KTB5RH4GX1UUBZU_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07a557cf1125cc4ee64fbaa7dad5ea0c97fbb6e3e23c1a4526f553947168a366 +size 5674 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6NF/6NF31L3LP2GUKGYM_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6NF/6NF31L3LP2GUKGYM_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..8e29e1a0f33192977ae85459bfaec9480c02fcfa --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6NF/6NF31L3LP2GUKGYM_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b97e60d573523ee7f639686e35275a58e4873017a265ad4b400f0944ed211db9 +size 5377 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6NS/6NS8MYNNPSRYSSG6_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6NS/6NS8MYNNPSRYSSG6_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..6dba6505c49427bd16544a0e2bb1a032afd5bc59 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6NS/6NS8MYNNPSRYSSG6_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9030695580bebe94a7fb8d49584004e5755dc7effd31fe88a948f9d29f1c321 +size 4293 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6PX/6PXCB46LUVBXDBA1_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6PX/6PXCB46LUVBXDBA1_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5ad8ace12521ffdfc1f52e723c2dd1aa311b212c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6PX/6PXCB46LUVBXDBA1_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75844ee07a8f3b56f682f73691398e1772895ff0916f6092489dcded1655f211 +size 4716 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6Q8/6Q8A6YRAEVT5JB8E_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6Q8/6Q8A6YRAEVT5JB8E_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..abb694e8b4a7fe96c4910606efd63ac784db4822 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6Q8/6Q8A6YRAEVT5JB8E_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91b5ea42a527be875f30e2b9512b70cc89280cc29267623280ca60004db541d2 +size 4304 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6R3/6R37JK4KYZMKHLP3_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6R3/6R37JK4KYZMKHLP3_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..2791ec0163fc4198af87d7ae137cf23c67ff90f4 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6R3/6R37JK4KYZMKHLP3_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47c4c832d412d30f2a4ae9f54352381e2d44b22249c48886156c2f298cdaad1d +size 4863 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6SV/6SVAQ2R7VTYQLHPU_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6SV/6SVAQ2R7VTYQLHPU_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..e968f6d9af1dd3f2cc6a3120ad5f2956473808c1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6SV/6SVAQ2R7VTYQLHPU_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5dd90c4fa625c3f754b0c7dccf9208ff204083d8eb492a04c5de51a44724ed56 +size 7055 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6TY/6TYUT7EWZ1S7NR4K_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6TY/6TYUT7EWZ1S7NR4K_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a62f81f487bf2b7c233ebb9bfc7ad526c3bd9b77 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6TY/6TYUT7EWZ1S7NR4K_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d747f983d866a44b555b2ffcccd00bc87f0c5b58a49702fb104bae1ade6a957 +size 4327 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6VD/6VDBLRLQ7MZA7BPJ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6VD/6VDBLRLQ7MZA7BPJ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9bc681aa973503ad999fce186bec1a3f47dc0bac --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6VD/6VDBLRLQ7MZA7BPJ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32a1127b83fb41b716ef4faaedaf56573483c8b5aa284dee9f778570c74effdd +size 4727 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6WM/6WM3RVH1ZLPVYX7U_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6WM/6WM3RVH1ZLPVYX7U_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..e89da467840730f5b27d1243101feb761ba7292c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6WM/6WM3RVH1ZLPVYX7U_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9385909edb356741ecc55228d149dd382bfa852f9773b17ba0d5aafbc3b5bf2e +size 4015 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/6XR/6XRA5H36HAFXHLJE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/6XR/6XRA5H36HAFXHLJE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9730967a1529886346223e66ecc8a22994db8419 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/6XR/6XRA5H36HAFXHLJE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eda4ab754554fab123749502de1712024b33f5adeef1669050a3defb11b9676 +size 2668 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/72B/72BL11YT2WD6AXW7_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/72B/72BL11YT2WD6AXW7_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..aa57022c30b0455b75db99325324c583069c8b01 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/72B/72BL11YT2WD6AXW7_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:383921240a491b2e12a6e3d278638cd95c6a2dfd02425c0dc68d652c8e0c823d +size 4408 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/792/792EEFZ8BGYJP438_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/792/792EEFZ8BGYJP438_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c946aa0d5d535d9cff0d9fbd148a9f02a439e798 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/792/792EEFZ8BGYJP438_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c632cbb4f8bb12b812c9381a2243afe0e354a2c0f810ab093142a4fa468fefd +size 3774 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7CM/7CMZ15S7YANWUTCE_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7CM/7CMZ15S7YANWUTCE_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..387adfd6f0c4af45a44180f798f39978d38c85f5 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7CM/7CMZ15S7YANWUTCE_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2da83f1ce4dff3def854124a6952c8695d61456158dae1540824193d42868297 +size 3723 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7CP/7CPHA52S6ZDDXC2F_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7CP/7CPHA52S6ZDDXC2F_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..08b0e3990a278218565e1730b386db6eaaa78ed1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7CP/7CPHA52S6ZDDXC2F_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecaa412747e172a0808dc8951bcd1a2f8a6a9155dd0c7788eb4c683cd847806d +size 4184 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7CV/7CVTV5PPKE2W8U4J_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7CV/7CVTV5PPKE2W8U4J_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..bcfe5b0ecc4bc40bf3ee9014e1ff827206f0972b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7CV/7CVTV5PPKE2W8U4J_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2a886f5cf80aa038c655994348746f98882fd3d86f2f743d2397c73ff272882 +size 4296 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7CY/7CYQ2ZRD7D8FR3DT_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7CY/7CYQ2ZRD7D8FR3DT_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..641e271d11a66d11f7239effa848ef6cc199f18e --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7CY/7CYQ2ZRD7D8FR3DT_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67d82b7b0a1c5451d2a57044ebc5bdac49e7089adf9d7972daa051b6c3508863 +size 3378 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7P9/7P93X9P49WP172ZS_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7P9/7P93X9P49WP172ZS_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..f01675471dafc384261f745720c44dbe5168de2a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7P9/7P93X9P49WP172ZS_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5dbda99f89454fb66c64b601a0fd5408b7f7796fc675da03e5ec77fa16a32479 +size 4323 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7QL/7QL1LKGYLQR1V1XF_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7QL/7QL1LKGYLQR1V1XF_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..147fa9edc2a5cc4f6cc6d5060641f93fbf8026b9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7QL/7QL1LKGYLQR1V1XF_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eac7f1750eb51d9b94b2ed1814696183a6729412075b8f369f674a1f0d07f7bc +size 4576 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7QQ/7QQ7ERAEB5ME73F6_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7QQ/7QQ7ERAEB5ME73F6_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..914d0b08f302cd993da513828165f329001ec54b --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7QQ/7QQ7ERAEB5ME73F6_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9e25bfa39951b3c7b58332ef0a504f021b1024d3730d18fa2ad1b5eb85f5816 +size 4483 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7TT/7TTPFSA224MU8EEM_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7TT/7TTPFSA224MU8EEM_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c1081b72be78d47120266de987477262f08f29b6 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7TT/7TTPFSA224MU8EEM_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83c74f7fb88dcff1336df6b5ce7aebd670d4348c29a3b5704f52dadba20a8cec +size 5428 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7V3/7V33AC4KURG7D9PS_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7V3/7V33AC4KURG7D9PS_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a95ad6b3746d9438474d7583e1bb6296cc40414c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7V3/7V33AC4KURG7D9PS_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf1bfb6b93dbd0a7812593233672537ed7bd6fa7bb025668919624f447f02e9e +size 3650 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7XK/7XKQME2UL7HN3JPB_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7XK/7XKQME2UL7HN3JPB_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5248f13510487433f23a07c8e5e1fc283e0fa4f9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7XK/7XKQME2UL7HN3JPB_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a6c0cc12e23f4d4e70564a8ac1a8bcdeb045652cedb5b2b5eaa64f14d3d2be2 +size 4330 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/7Y6/7Y6LAVNTRQ2VQ9GC_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/7Y6/7Y6LAVNTRQ2VQ9GC_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..9f0d691a1e4affebed50577fb77b92b687553488 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/7Y6/7Y6LAVNTRQ2VQ9GC_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:474bfb189144e33b2bbfb3285627c339e5170ea3c1fa3ccb8fc087b0648c0a54 +size 4348 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/826/826U3J398ZHW3RNV_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/826/826U3J398ZHW3RNV_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7b4adcc1068794cd62475ee33efbf730bfb07424 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/826/826U3J398ZHW3RNV_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adcc23714b838351ddf995bc989f512f661ed0fe351623c28984197f60aa09a0 +size 3959 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/83U/83UPBSWA24U4MKL2_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/83U/83UPBSWA24U4MKL2_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..89bfdf91c22402142362ad9d87d5086be889e59e --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/83U/83UPBSWA24U4MKL2_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca98b430e98bc620585f4f9ec0671b4771e5e9896d1e124b731eab92dd5d5397 +size 4177 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8BN/8BNRRXNUY7UL123U_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8BN/8BNRRXNUY7UL123U_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..33e164448af4a4a10202a9a9022ac8bae9a7fe4a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8BN/8BNRRXNUY7UL123U_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:618b115b2b88ddf7437eff6ac825efa2700d61e363f3e4efcf608b5d502f102f +size 4046 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8D2/8D2VNZQX37ZAYNEC_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8D2/8D2VNZQX37ZAYNEC_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..84fd61e1b124f06ad9c99e2980479efade7f276c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8D2/8D2VNZQX37ZAYNEC_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c98e827e72929ac982339d16cd250052a9ba652b7efdfecb94702548662f4d37 +size 3977 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8D3/8D39ZHMZYJSZY8ST_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8D3/8D39ZHMZYJSZY8ST_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..b9401ecc4d3c4f620565be2c32a0339e59ca912c --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8D3/8D39ZHMZYJSZY8ST_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b1980c766417140b4a8d43093f95430589de3b70f5badab87e9bc2be9cdc3f1 +size 6536 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8FH/8FH8WL5AEZVTNTYU_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8FH/8FH8WL5AEZVTNTYU_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..1dbf4b53d34219903d5467f3164a0cd4a1d667d9 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8FH/8FH8WL5AEZVTNTYU_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e1b8a97afb4aeb6196286dda24f9565eba2da53c5cf07b52133220eb5fb5ebc +size 3850 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8G8/8G8MESMRGNX39JEF_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8G8/8G8MESMRGNX39JEF_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..380c88644cdfe1b4a72f6086ada0cf4be55260b2 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8G8/8G8MESMRGNX39JEF_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85ec79a47837700dd6f7c7edbe64c3a9693538f810294d0399961c92e06594ad +size 3773 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8LD/8LD361GFEN7C3L3E_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8LD/8LD361GFEN7C3L3E_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..5622b400d14adae549d0ba8d5f1dd8e7f81e2486 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8LD/8LD361GFEN7C3L3E_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69bf8451bfdecca9b10a7dff05756bfeb05397baeb2ec38249bdaed1e56d9ca2 +size 3787 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8MM/8MMF8A3AZKYXVG84_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8MM/8MMF8A3AZKYXVG84_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..967c1aae72ef9f61cc756274b8f72e5ee1f35a7a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8MM/8MMF8A3AZKYXVG84_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c95e4b4341591142c0933410eb6f3175cddaa9a014973152e96caaad6d575a6e +size 3746 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8RY/8RYCAMDQT4HVJ15B_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8RY/8RYCAMDQT4HVJ15B_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..b090c9ed4e290e57dd55ddb80450d9f6b378e782 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8RY/8RYCAMDQT4HVJ15B_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:095baf1430ac31b6dbead53411337a6d7cfe1acac3d8c9aafb9c16abdbc9dc25 +size 3689 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8UL/8ULND6ZTVDDPNC9R_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8UL/8ULND6ZTVDDPNC9R_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..42a20cbd47953bb7a4ebb0c4c68c09bc8e67391a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8UL/8ULND6ZTVDDPNC9R_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b84258d04111dd2a40b0a89cee4dc9f65ce51cb83c50e2bfc3267962182c966d +size 4758 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8X3/8X3Z8H3KBXDDR38B_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8X3/8X3Z8H3KBXDDR38B_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..6be8dc5a2059a169ce6b7c88e4e8eb7523d7880a --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8X3/8X3Z8H3KBXDDR38B_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a11923079c3209a787edc617cfde029aa7c969309680e1028ba3dc35df31d0c +size 4158 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/8XN/8XN1MFR88UYCWGCX_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/8XN/8XN1MFR88UYCWGCX_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..422cc2b26574757aa212603f70fabc55f3fb4dcf --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/8XN/8XN1MFR88UYCWGCX_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f95e86d691651766449ce5b475e2f31a9ff6d74f106fdc81fd905bac9e3b7f73 +size 3450 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/915/915Z7FMSZWC44AUT_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/915/915Z7FMSZWC44AUT_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..13d2af5598bf2f4e0f43d1c96f7bd11a010f1a2d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/915/915Z7FMSZWC44AUT_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f12e9b1dd63249d063a241c226a5110a81af3aab2eaa533ca190b941c2eb2997 +size 5400 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/91R/91RY9UMLEPT86CP3_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/91R/91RY9UMLEPT86CP3_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..56cdce4f681be067bb93e88f15d278b379583df0 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/91R/91RY9UMLEPT86CP3_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a8134d6c671f1d14828ca7bca9111ad9dbb9ec7eb6d99041b20b0c8fcd12742 +size 2634 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/92E/92EZC2C1ESN9UW4P_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/92E/92EZC2C1ESN9UW4P_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..f4304ad9e2a32466aa4a4920adf255a4e55665be --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/92E/92EZC2C1ESN9UW4P_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56a2bf7a6c55d1c8fc44604661f152df58d487c20286d42942103efed1b586b5 +size 3946 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/92K/92KSG3E45DZ9TCJ5_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/92K/92KSG3E45DZ9TCJ5_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..fa48db9bcb3e5634d970e3cd850e5adca2354191 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/92K/92KSG3E45DZ9TCJ5_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7b9062e1d86ae1204ca336735d24abfab637628bb5b4f5b630665f44093e6be +size 6272 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/94T/94TFUCA35D1DJ56W_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/94T/94TFUCA35D1DJ56W_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..632c522e1d1b0632ce27019d06eaebb75617308d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/94T/94TFUCA35D1DJ56W_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27dd32419646c552d5d5643a8ea313b78b1995f1d0fec69865d6bafb6593fea2 +size 3794 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/968/968V76CYD53GE4RV_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/968/968V76CYD53GE4RV_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..c661f65a1b531b2d26cadd79f9ab9bd458b35045 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/968/968V76CYD53GE4RV_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdb447305f8ad4f0266476fd154f5292f87deb24fa5bf915c0b93d27f37f7f76 +size 3898 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/99L/99LBZPR14PEYLZ69_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/99L/99LBZPR14PEYLZ69_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..908dea06fa15b1be511a033b2baee5aefe95a0af --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/99L/99LBZPR14PEYLZ69_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1407a8c884a9d4443b89c51ef83c5dd313fbf8b31093d6dc7ade95b27a3cd3c +size 4211 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9ER/9ER17A3RBS4T634Z_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9ER/9ER17A3RBS4T634Z_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7e96a1010f231e9076e8d9a129e51a617c42b0e7 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9ER/9ER17A3RBS4T634Z_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb68be857a8e78cbb5c4cb9e862cbc436c6962d3ed4765dfa6e88fa02e759263 +size 3772 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9J6/9J6R1MJ327N5PGKP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9J6/9J6R1MJ327N5PGKP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..db2ac77b7b9231ed7404fc4eede055882e873ecc --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9J6/9J6R1MJ327N5PGKP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8b0b8122a6948aa8c3e132e8d6057e730ec2c93687b348f23ed1baf912d7aad +size 2951 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9QH/9QHVPTZ83BSLMF1Q_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9QH/9QHVPTZ83BSLMF1Q_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..199c219f26794e9f073e3e93cc384d9ba2e56c6d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9QH/9QHVPTZ83BSLMF1Q_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbc60826de40ada8dc623275528e9eff1e8a0dcaebb039a82d092c199fb0165d +size 6210 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9QS/9QSB76C1K9H9L4UQ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9QS/9QSB76C1K9H9L4UQ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..778730c68cbe140826834afec23920c7e3728d16 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9QS/9QSB76C1K9H9L4UQ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f18efdb2dac52f82ce5205963fdb54e6ab2def7f331fee2e23e07cfa272543a +size 3644 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9SV/9SVVM96KFSDFMUY6_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9SV/9SVVM96KFSDFMUY6_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..930deb26ed25ba57578d1a659807ae40a65c1d50 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9SV/9SVVM96KFSDFMUY6_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:314921e0a0145447190be6f70d7af4465b21b8447405b7f56d7a0ddac25b4f2d +size 5574 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9ZB/9ZB6LU34Y6LWY3SZ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9ZB/9ZB6LU34Y6LWY3SZ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..ee213f5dd7fd84f56e0191374234e900e276960d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9ZB/9ZB6LU34Y6LWY3SZ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:914e5234d42ea6cd86ee62463c47d7d43b1d0784da25996f8ddcc5e2c1a5e53c +size 3317 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9ZH/9ZH1G85TFQP6Z99K_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9ZH/9ZH1G85TFQP6Z99K_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..209815c709bec249a5705b93b39c5eac97135fec --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9ZH/9ZH1G85TFQP6Z99K_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:386918f27d9dd9dc1443e396be65a99b83c0dbc6c4e6cb24b50ffb933a522b52 +size 4232 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9ZM/9ZMQ3M9JVC5F7YEP_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9ZM/9ZMQ3M9JVC5F7YEP_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..285647529f731a975d9283cd5c7082e37c96189d --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9ZM/9ZMQ3M9JVC5F7YEP_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d38725818b2a4cadfdb2108a188eefd7150b37c007e33553ae733bade47bae60 +size 3467 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/9ZU/9ZUKYA6XSJM22FGH_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/9ZU/9ZUKYA6XSJM22FGH_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..8d96efce5da237c41e7903e262585d11586d5bd1 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/9ZU/9ZUKYA6XSJM22FGH_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dddde0b4775ec382caf1b1cc36470627b833c60ed4a87cf3292ac7d43b1e6a38 +size 2513 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/GZD/GZDXCMA4QWCU4W85_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/GZD/GZDXCMA4QWCU4W85_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..3ab214762ea60a75620cea8a04946ee0c85c86ca --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/GZD/GZDXCMA4QWCU4W85_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:947d691de29af9f8e707784ee3cb82345b3bfe815da767a25068ae83d13c7de3 +size 4095 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/H1M/H1MZESVGAC3NXH19_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/H1M/H1MZESVGAC3NXH19_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..edd9e6d68d92e1f89d1e65415b915a537884939f --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/H1M/H1MZESVGAC3NXH19_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a4ad444d45de5abadaaa2fb0a2d4fe7aec406421c1f2958ec31847c053931aa +size 4523 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/H1Q/H1QVFRHKS2JDN3WC_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/H1Q/H1QVFRHKS2JDN3WC_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..a21288efbf400468354542272c918bce03a66481 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/H1Q/H1QVFRHKS2JDN3WC_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e24f79b7f76d54a642a281ae73a95e1b2b186a50bb08db278624fd73d932610e +size 3600 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/H2C/H2CHCP39JTM9VD24_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/H2C/H2CHCP39JTM9VD24_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..53a1c2fd9e05582c3db80183ae681e9aa0eea406 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/H2C/H2CHCP39JTM9VD24_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:723b8c04f46c4804f9f2cce96d57cc817eb9edee46b9a278e0dd8e85be55f026 +size 4187 diff --git a/entropydrop_website_generations/SKING_DDJ_v54/H6H/H6HCYCPRU5XGDJGQ_master_v73.png b/entropydrop_website_generations/SKING_DDJ_v54/H6H/H6HCYCPRU5XGDJGQ_master_v73.png new file mode 100644 index 0000000000000000000000000000000000000000..7bc1a463fc527316a7026ea60f24d1bdafe8fd30 --- /dev/null +++ b/entropydrop_website_generations/SKING_DDJ_v54/H6H/H6HCYCPRU5XGDJGQ_master_v73.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eda3aabe8b9cf467565a3b5e5bea18fbc221962245d36802c2b0e021d5e3561 +size 5930