1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3795],{43795:function(e,n,o){o.r(n),o.d(n,{LightRig:function(){return B},SceneEnvironment:function(){return p.DH},SceneLights:function(){return p.HF}});var t=o(27573),l=o(7653),i=o(97551),a=o(46957),r=o(43089),u=o(66101),s=o(78813),d=o(84405),c=o(50078),p=o(6247);let v={hemisphere:s.HemisphereLightHelper,directional:s.DirectionalLightHelper,point:s.PointLightHelper,spot:s.SpotLightHelper},h=0,m=()=>"light_".concat(++h),g=new Map,f=new Map,w={config:{},fileName:null},y=e=>"[".concat(e.map(e=>+e.toFixed(2)).join(", "),"]");function x(e){let{id:n,type:o,index:d,selected:c,showHelpers:h,initial:m,onSelect:w}=e,{scene:y}=(0,i.D)(),x=(0,l.useRef)(null),C=(0,l.useRef)(new s.Object3D),[b,B]=(0,l.useState)(null),S="".concat(d+1," \xb7 ").concat(o),[E,L]=(0,u.M4)(S,()=>({...function(e,n){var o,t,l,i,a,r,u,s,d,c,v,h,m,g,f,w,y,x;let C=p._A,b={color:null!==(o=null==n?void 0:n.color)&&void 0!==o?o:C.color,intensity:{value:null!==(t=null==n?void 0:n.intensity)&&void 0!==t?t:C.intensity,min:0,max:30,step:.1}};return(0,p.rO)(e)&&(b.position={value:null!==(l=null==n?void 0:n.position)&&void 0!==l?l:C.position,step:.1}),"hemisphere"===e&&(b.groundColor=null!==(i=null==n?void 0:n.groundColor)&&void 0!==i?i:C.groundColor),("point"===e||"spot"===e)&&(b.distance={value:null!==(a=null==n?void 0:n.distance)&&void 0!==a?a:C.distance,min:0,max:50,step:.5},b.decay={value:null!==(r=null==n?void 0:n.decay)&&void 0!==r?r:C.decay,min:0,max:4,step:.1}),"spot"===e&&(b.angle={value:null!==(u=null==n?void 0:n.angle)&&void 0!==u?u:C.angle,min:0,max:Math.PI/2,step:.01},b.penumbra={value:null!==(s=null==n?void 0:n.penumbra)&&void 0!==s?s:C.penumbra,min:0,max:1,step:.01},b.focus={value:null!==(d=null==n?void 0:n.focus)&&void 0!==d?d:C.focus,min:0,max:1,step:.01}),(0,p.e8)(e)&&(b.target={value:null!==(c=null==n?void 0:n.target)&&void 0!==c?c:C.target,step:.1}),(0,p.BA)(e)&&(b.castShadow=null!==(v=null==n?void 0:n.castShadow)&&void 0!==v&&v,b.shadowBias={value:null!==(h=null==n?void 0:n.shadowBias)&&void 0!==h?h:C.shadowBias,min:-.01,max:.01,step:1e-4},b.shadowNormalBias={value:null!==(m=null==n?void 0:n.shadowNormalBias)&&void 0!==m?m:C.shadowNormalBias,min:0,max:2,step:.01},b.shadowRadius={value:null!==(g=null==n?void 0:n.shadowRadius)&&void 0!==g?g:C.shadowRadius,min:0,max:25,step:.5},b.shadowMapSize={value:null!==(f=null==n?void 0:n.shadowMapSize)&&void 0!==f?f:C.shadowMapSize,options:[512,1024,2048,4096]},b.shadowNear={value:null!==(w=null==n?void 0:n.shadowNear)&&void 0!==w?w:C.shadowNear,min:.01,max:10,step:.01},b.shadowFar={value:null!==(y=null==n?void 0:n.shadowFar)&&void 0!==y?y:C.shadowFar,min:1,max:100,step:1},"directional"===e&&(b.shadowCameraSize={value:null!==(x=null==n?void 0:n.shadowCameraSize)&&void 0!==x?x:C.shadowCameraSize,min:1,max:40,step:.5})),b}(o,m),select:(0,u.LI)(()=>w()),remove:(0,u.LI)(()=>{var e;return null===(e=f.get(n))||void 0===e?void 0:e()})}),{collapsed:!0}),k={type:o,...E};(0,l.useEffect)(()=>{g.set(n,{cfg:k,ref:x})}),(0,l.useEffect)(()=>()=>void g.delete(n),[n]);let N=v[o],R="point"===o?.25:"directional"===o?.6:"hemisphere"===o?.6:void 0;(0,a.H)(h&&N?x:null,null!=N?N:s.PointLightHelper,...void 0!==R?[R]:[]),(0,l.useEffect)(()=>{x.current&&(0,p.IE)(x.current,k,y,C.current)}),(0,l.useEffect)(()=>{let e=C.current;return()=>{e.parent&&y.remove(e)}},[y]);let j=(0,p.rO)(o)?E.position:null;return(0,t.jsxs)(t.Fragment,{children:[(0,l.createElement)(p.VC[o],{ref:e=>{x.current=e,B(e)},...(0,p.II)(k)}),h&&j&&(0,t.jsxs)("mesh",{position:j,onClick:w,scale:c?.13:.1,children:[(0,t.jsx)("sphereGeometry",{args:[1,16,16]}),(0,t.jsx)("meshBasicMaterial",{color:c?"#ffe14d":E.color,wireframe:!c})]}),h&&c&&b&&(0,t.jsx)(r.Y,{object:b,mode:"translate",size:.7,onObjectChange:()=>{b&&L({position:b.position.toArray()})}})]})}function C(e){var n;let{initial:o}=e,[i,a]=(0,l.useState)(null),[r,v]=(0,l.useState)(null!==(n=null==o?void 0:o.files)&&void 0!==n?n:null),h=(0,l.useRef)(null),m=(0,l.useRef)(null),g=(0,l.useCallback)((e,n,o)=>{var t;let l=null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase(),i=t=>{var l;t.mapping=s.EquirectangularReflectionMapping,a(e=>(null==e||e.dispose(),t)),v(n),null===(l=m.current)||void 0===l||l.call(m,{file:n}),o&&URL.revokeObjectURL(e)};"hdr"===l?new d.x().load(e,i):"exr"===l?new c.I().load(e,i):new s.TextureLoader().load(e,e=>
1{e.colorSpace=s.SRGBColorSpace,i(e)})},[]);(0,l.useEffect)(()=>{let e=document.createElement("input");e.type="file",e.accept=".hdr,.exr,.jpg,.jpeg,.png,.webp",e.style.display="none";let n=e=>{var n;let o=e.target,t=null===(n=o.files)||void 0===n?void 0:n[0];t&&g(URL.createObjectURL(t),t.name,!0),o.value=""};return e.addEventListener("change",n),document.body.appendChild(e),h.current=e,()=>{e.removeEventListener("change",n),e.remove()}},[g]),(0,l.useEffect)(()=>{(null==o?void 0:o.files)&&g(o.files,o.files,!1)},[]);let f=p.gV,[y,x]=(0,u.M4)("environment (hdri)",()=>{var e,n,t,l;return{file:{value:null!=r?r:"(none)",disabled:!0},"load HDRIâ¦":(0,u.LI)(()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.click()}),intensity:{value:null!==(e=null==o?void 0:o.intensity)&&void 0!==e?e:f.intensity,min:0,max:5,step:.05},rotationY:{value:s.MathUtils.radToDeg(null!==(n=null==o?void 0:o.rotationY)&&void 0!==n?n:f.rotationY),min:0,max:360,step:1,label:"rotationY\xb0"},showBackground:null!==(t=null==o?void 0:o.showBackground)&&void 0!==t?t:f.showBackground,backgroundBlur:{value:null!==(l=null==o?void 0:o.backgroundBlur)&&void 0!==l?l:f.backgroundBlur,min:0,max:1,step:.01},clear:(0,u.LI)(()=>{var e;a(e=>(null==e||e.dispose(),null)),v(null),null===(e=m.current)||void 0===e||e.call(m,{file:"(none)"})})}},{order:-.5,collapsed:!0});m.current=x;let C={intensity:y.intensity,rotationY:s.MathUtils.degToRad(y.rotationY),showBackground:y.showBackground,backgroundBlur:y.backgroundBlur};return(0,l.useEffect)(()=>{w={config:C,fileName:r}}),(0,t.jsx)(p.DH,{config:C,texture:i})}function b(e){let{initialLights:n,initialEnvironment:o}=e,[i,a]=(0,l.useState)(()=>(null!=n?n:[]).map(e=>({id:m(),type:e.type,initial:e}))),[r,s]=(0,l.useState)(null),[{helpers:d}]=(0,u.M4)("light rig",()=>({type:{value:"point",options:p.FJ},helpers:{value:!0,label:"show handles"},"add light":(0,u.LI)(e=>{let n=e("light rig.type"),o=m();a(e=>[...e,{id:o,type:n}]),s(o)}),"export â":(0,u.LI)(()=>{var e;let n="".concat(function(){let e=[];for(let{cfg:l,ref:i}of g.values()){var n,o,t;let a=null!==(o=null===(n=i.current)||void 0===n?void 0:n.position.toArray())&&void 0!==o?o:l.position,r=["type: '".concat(l.type,"'")];if((0,p.rO)(l.type)&&a&&r.push("position: ".concat(y(a))),r.push("intensity: ".concat(l.intensity)),r.push("color: '".concat(l.color,"'")),"hemisphere"===l.type&&r.push("groundColor: '".concat(l.groundColor,"'")),("point"===l.type||"spot"===l.type)&&r.push("distance: ".concat(l.distance),"decay: ".concat(l.decay)),"spot"===l.type&&r.push("angle: ".concat((null!==(t=l.angle)&&void 0!==t?t:0).toFixed(3)),"penumbra: ".concat(l.penumbra),"focus: ".concat(l.focus)),(0,p.e8)(l.type)){let e=l.target;e&&(e[0]||e[1]||e[2])&&r.push("target: ".concat(y(e)))}l.castShadow&&(r.push("castShadow: true","shadowBias: ".concat(l.shadowBias),"shadowNormalBias: ".concat(l.shadowNormalBias),"shadowRadius: ".concat(l.shadowRadius),"shadowMapSize: ".concat(l.shadowMapSize),"shadowNear: ".concat(l.shadowNear),"shadowFar: ".concat(l.shadowFar)),"directional"===l.type&&r.push("shadowCameraSize: ".concat(l.shadowCameraSize))),e.push(" { ".concat(r.join(", ")," },"))}return"const CONTACT_LIGHTS: LightConfig[] = [\n".concat(e.join("\n"),"\n];")}(),"\n\n").concat(function(){var e,n,o,t;let{config:l,fileName:i}=w;if(!i)return"const CONTACT_ENVIRONMENT: EnvironmentConfig = {};";let a=["files: '/hdri/".concat(i,"'"),"intensity: ".concat((null!==(e=l.intensity)&&void 0!==e?e:1).toFixed(2)),"rotationY: ".concat((null!==(n=l.rotationY)&&void 0!==n?n:0).toFixed(4)),"showBackground: ".concat(null!==(o=l.showBackground)&&void 0!==o&&o),"backgroundBlur: ".concat((null!==(t=l.backgroundBlur)&&void 0!==t?t:0).toFixed(2))];return"// Copy the uploaded HDRI into public/hdri/ for this path to resolve.\n"+"const CONTACT_ENVIRONMENT: EnvironmentConfig = {\n ".concat(a.join(",\n "),",\n};")}());console.log("%c[LightRig] export:","color:#7CFC00","\n"+n),null===(e=navigator.clipboard)||void 0===e||e.
1writeText(n).catch(()=>{})})}),{order:-1});return(0,l.useEffect)(()=>(i.forEach(e=>{let{id:n}=e;return f.set(n,()=>{a(e=>e.filter(e=>e.id!==n)),s(e=>e===n?null:e)})}),()=>{i.forEach(e=>{let{id:n}=e;return f.delete(n)})}),[i]),(0,t.jsxs)(t.Fragment,{children:[i.map((e,n)=>(0,t.jsx)(x,{id:e.id,type:e.type,index:n,selected:r===e.id,showHelpers:d,initial:e.initial,onSelect:()=>s(e.id)},e.id)),(0,t.jsx)(C,{initial:o})]})}function B(e){let{initialLights:n,initialEnvironment:o}=e;return(0,t.jsx)(b,{initialLights:n,initialEnvironment:o})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.