1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7297],{1894:(e,t,a)=>{a.d(t,{CssTextField:()=>c,Item:()=>d,Q:()=>p,theme:()=>s,w:()=>u});var r=a(61313),n=a(2300),i=a(33840),l=a(48116),o=a(61023);a(62158);let s=(0,i.A)({typography:{fontFamily:"Fira Code,monospace",fontSize:12},status:{danger:"#db504a",disabled:"#646F6C"},palette:{primary:{contrastText:"#FF6F59",main:"#B2b09B",darker:"#11161a",light:"#43aa8b",dark:"#254441"},dracula:{background:"#282a36",currentLine:"#44475a",selection:"#44475a",foreground:"#f8f8f2",comment:"#6272a4",cyan:"#8be9fd",green:"#50fa7b",orange:"#ffb86c",pink:"#ff79c6",purple:"#bd93f9",red:"#ff5555",yellow:"#f1fa8c"},text:{primary:"#f8f8f2",secondary:"#6272a4"},background:{default:"#040a0f",paper:"#11161a"},neutral:{main:"#AAD2E6",contrastText:"#F7CE5B"}},components:{MuiCssBaseline:{styleOverrides:{body:(0,r.A)(),a:{color:"#f8f8f2",textDecoration:"none"}}}}}),d=(0,l.Ay)(n.A)(e=>{let{theme:t}=e;return{backgroundColor:t.palette.primary.darker,...t.typography.body2,padding:t.spacing(1),textAlign:"center",color:t.palette.text.secondary}}),u=(0,l.Ay)(n.A)(e=>{let{theme:t}=e;return{backgroundColor:t.palette.primary.darker,justifyContent:"center",display:"inline-flex",borderRadius:"4px"}}),c=(0,l.Ay)(o.A)({"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:s.palette.dracula.currentLine},"&:hover fieldset":{borderColor:s.palette.dracula.currentLine},"&.Mui-focused fieldset":{borderColor:s.palette.dracula.foreground},"&.Mui-focused input":{color:s.palette.dracula.foreground},"& input:disabled":{color:s.status.disabled,WebkitTextFillColor:s.status.disabled}}}),g=[s.palette.dracula.cyan,s.palette.dracula.green,s.palette.dracula.orange,s.palette.dracula.pink,s.palette.dracula.purple,s.palette.dracula.red,s.palette.dracula.yellow],p=e=>g[e%g.length]},16168:(e,t,a)=>{a.d(t,{M:()=>l,w:()=>d});var r=a(61361);let n="Could not load image. Check that it is a valid",i=r.map(e=>{let t=e.domain.trim().toLowerCase();if(t.startsWith("**"))throw Error("** wildcard is not supported");if(t.startsWith("*")){let e=t.split("*");if(2!==e.length)throw Error("Only one wildcard in allowed texture domain, at the start");return t=>!t.split(e[1])[0].includes(".")}return e=>e===t}),l=async e=>{let t=e.match(/^https:\/\/polyhaven.com\/a\/([\w_]+)$/);if(t){var a,r,l,o,s;let n=t[1],i=await fetch("https://api.polyhaven.com/files/".concat(n)),d=await i.json();if(d.hdri)return{img:null==(r=d.hdri["2k"])||null==(a=r.hdr)?void 0:a.url,thumb:null==(l=d.tonemapped)?void 0:l.url,url:e};if(d.Diffuse){let t=Object.keys(d)[0];return{img:null==(s=d[t]["1k"])||null==(o=s.jpg)?void 0:o.url,url:e}}throw Error("Unrecognised Poly Haven API response")}return{img:await (e=>{let t=e.trim();return new Promise((e,a)=>{let r,l=/^https:\/\//i.test(t)?t:"https://".concat(t);try{r=new URL(l)}catch(e){throw"Invalid URL"}if(!i.some(e=>e(r.hostname)))throw"URL not included in allowed domains";fetch(r).then(t=>{if(!t.ok)return void a("Could not retrieve texture from remote source, status ".concat(t.status));t.arrayBuffer().then(t=>{if(t.byteLength>3e7)throw"File too large. ".concat("30.00")+"MB is the maximum allowed size";let i=new Image;i.addEventListener("load",()=>{"naturalHeight"in i&&(i.naturalHeight+i.naturalWidth===0?a(n):i.naturalHeight>8192?a("Maximum image height is ".concat(8192,"px")):i.naturalWidth>8192?a("Maximum image width is ".concat(8192,"px")):e(r.href)),a(n),setTimeout(()=>{i=null})}),i.addEventListener("error",()=>{a(n),setTimeout(()=>{i=null})}),i.src=r.href})}).catch(()=>{a("Failed to load image. If the URL is valid, the resource may not allow cross-origin fetching")})})})(e)}},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"diff";return{img:"https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/".concat(e,"/").concat(e,"_").concat(t,"_1k.jpg"),url:"https://polyhaven.com/a/".concat(e)}},s=e=>({img:"https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/2k/".concat(e,"_2k.hdr"),thumb:"https://dl.polyhaven.org/file/ph-assets/HDRIs/extra/Tonemapped%20JPG/".concat(e,".jpg"),url:"https://polyhaven.com/a/".concat(e)}),d=[o("stone_brick_wall_001"),o("wood_table_001"),o("rusty_metal_02"),o("rock_pitted_mossy"),o("aerial_rocks_02"),o("book_pattern","col2"),s("autumn_crossing"),s("dikhololo_night"),s("leadenhall_market"),s("music_hall_01"),s("spruit_sunrise"),s("vatican_road"),{img:"/textures/blank.png"},{img:"https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Regent_Street_Clay_Gregory.jpg/1920px-Regent_Street_Clay_Gregory.jpg"},{img:"/textures/anim0.png"},{img:"/textures/bayer0.png"},{img:"https://raw.githubusercontent.com/otaviogood/shader_fontgen/master/codepage12.png"},o("rocks_ground_01","disp"),{img:"/textures/noise0.png"},{img:"/textures/noise1.png"},{img:"/textures/noise2.png"},{img:"/textures/noise3.png"},{img:"/textures/noise4.png"}]},26148:(e,t,a)=>{a.d(t,{At:()=>s,C3:()=>l,DK:()=>d,EP:()=>P,G:()=>E,G7:()=>h,Hq:()=>y,IP:()=>z,Qv:()=>g,RM:()=>w,RX:()=>Y,TQ:()=>T,XI:()=>b,YX:()=>U,Y_:()=>R,aY:()=>C,an:()=>H,au:()=>M,b3:()=>o,d6:()=>v,fn:()=>j,ge:()=>A,gv:()=>L,jo:()=>f,k5:()=>S,l3:()=>c,n0:()=>Q,n4:()=>x,np:()=>m,qQ:()=>_,rl:()=>I,sW:()=>F,wL:()=>N,wM:()=>D,wZ:()=>k,yZ:()=>p,yt:()=>u});var r=a(80074),n=a(51208),i=a(98384);let l=(0,r.eU)(!0),o=(0,r.eU)(!1),s=(0,r.eU)(!1),d=(0,r.eU)(!1),u=(0,r.eU)(!1),c=(0,r.eU)({summary:"",position:{row:0,col:0},success:!0}),g=(0,r.eU)(!1),p=(0,r.eU)(!1),m=(0,r.eU)(!1),f=(0,r.eU)(0),h=(0,r.eU)(0),x=(0,r.eU)(0),y=(0,r.eU)([]),b=(0,r.eU)(!1),v=(0,r.eU)(!1),w=(0,n.tx)(i),
1k=(0,n.tx)(!1),R=(0,n.tx)(!1),A=(0,n.tx)(!1),U=(0,n.tx)(!1),_=(0,n.tx)("New Shader"),C=(0,n.tx)(""),M=(0,n.tx)("private"),j=(0,n.tx)([{img:"/textures/blank.png"},{img:"/textures/blank.png"}]),Y=(0,n.tx)([{width:128,height:128},{width:128,height:128}]),I=(0,n.tx)([]),L=(0,n.tx)([]),S=(0,r.eU)(new Map),E=(0,r.eU)(new Map),D=(0,n.tx)(!0),N=(0,r.eU)(!1),F=(0,n.tx)(""),P=(0,n.tx)(!1),Q=(0,n.tx)("sRGB"),z=(0,n.tx)(!0),H=(0,n.tx)("wgsl"),T=(0,n.tx)(!1)},61361:e=>{e.exports=JSON.parse('[{"domain":"dl.polyhaven.org","displayName":"Poly Haven","referenceUrl":"https://polyhaven.com/"},{"domain":"*.github.io","displayName":"GitHub Pages","referenceUrl":"https://pages.github.com/"},{"domain":"raw.githubusercontent.com","displayName":"GitHub User Content","referenceUrl":"https://github.com"},{"domain":"upload.wikimedia.org","displayName":"Wikimedia Commons","referenceUrl":"https://commons.wikimedia.org/"}]')},89042:(e,t,a)=>{a.d(t,{A:()=>_,i:()=>k});var r=a(95155),n=a(59734),i=a(35120),l=a(85790),o=a(25355),s=a(37960),d=a(20537),u=a(52853),c=a(37953),g=a(99110),p=a(80777),m=a(48116),f=a(33567),h=a(61023),x=a(77202),y=a(26148),b=a(12115),v=a(1894),w=a(74879);let k=e=>{let t=new Map;return e.forEach(e=>{let a=(0,w.A)();t.set(a,{getVal:()=>e.value,getUniform:()=>e.name,getUUID:()=>a,getMinRange:()=>e.minRange,getMaxRange:()=>e.maxRange})}),t},R=(0,m.Ay)(h.A)({"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:v.theme.palette.dracula.currentLine},"&:hover fieldset":{borderColor:v.theme.palette.dracula.currentLine},"&.Mui-focused fieldset":{borderColor:v.theme.palette.dracula.foreground},"&.Mui-focused input":{color:v.theme.palette.dracula.foreground},"& input:disabled":{color:v.theme.status.disabled,WebkitTextFillColor:v.theme.status.disabled},float:"left"}}),A=(0,b.forwardRef)((e,t)=>{let[a,n]=(0,b.useState)("Uniform"),[i,l]=(0,b.useState)(!1),o=(0,x.Xr)(y.DK);return(0,b.useEffect)(()=>{n(e.sliderUniform)},[e.sliderUniform]),(0,r.jsx)(R,{error:i,id:"outlined-name","aria-label":"Uniform name input",sx:{display:"table-cell",gridRow:"1",gridColumn:"span 3",verticalAlign:"middle",input:{color:(0,v.Q)(e.index)},label:{color:(0,v.Q)(e.index)}},inputRef:t,size:"small",label:i?"Invalid":"Name",value:a,onKeyDown:e=>{13===e.keyCode&&t.current.blur()},onChange:e=>{n(e.target.value)},onBlur:t=>{((e,t,a)=>{let r=e.match(/^[a-zA-Z][a-zA-Z0-9_]*$/),n=r&&1===r.length,i=[...a.keys()].find(r=>t!==r&&a.get(r).getUniform()===e);return n&&!i})(t.target.value,e.uuid,e.sliderRefMap)?(e.setSliderUniform(t.target.value),o(!0),l(!1)):l(!0)}})});A.displayName="CustomTextField";let U=e=>{var t,a;let n,l=e.sliderRefMap.has(e.uuid)&&e.sliderRefMap.get(e.uuid),[o,s]=(0,b.useState)(l?e.sliderRefMap.get(e.uuid).getVal():0),[d,p]=(0,b.useState)(l?e.sliderRefMap.get(e.uuid).getUniform():"uniform_"+e.index),[m,f]=(0,b.useState)((null==(t=e.sliderRefMap.get(e.uuid))?void 0:t.getMinRange())||0),[h,w]=(0,b.useState)((null==(a=e.sliderRefMap.get(e.uuid))?void 0:a.getMaxRange())||1),k=(0,x.Xr)(y.wL),U=(0,b.useRef)(null);return(0,b.useEffect)(()=>{n={getVal:()=>o,getUniform:()=>d,getUUID:()=>e.uuid,getMinRange:()=>m,getMaxRange:()=>h},e.setRefCallback(n),k(!0)}),(0,r.jsxs)(u.A,{sx:{display:"inline-grid",gridAutoColumns:"1fr",gap:1,width:"100%",paddingLeft:"0em",alignItems:"center",color:(0,v.Q)(e.index)},children:[(0,r.jsx)(A,{index:e.index,ref:U,uuid:e.uuid,sliderUniform:d,setSliderUniform:p,sliderRefMap:e.sliderRefMap}),(0,r.jsx)(R,{label:"Min",type:"number",size:"small",value:m,sx:{display:"table-cell",gridRow:"1",gridColumn:"span 1",verticalAlign:"middle",input:{color:(0,v.Q)(e.index)},label:{color:(0,v.Q)(e.index)}},InputLabelProps:{shrink:!0},onChange:e=>{let t=+e.target.value;t<h&&f(t)}}),(0,r.jsx)(g.Ay,{"aria-label":d+" slider",sx:{display:"table-cell",gridRow:"1",gridColumn:"span 7",verticalAlign:"middle",color:(0,v.Q)(e.index)},defaultValue:0,step:.001,min:m,max:h,valueLabelDisplay:"auto",value:o,onChange:(e,t)=>
1{s(t)}}),(0,r.jsx)(R,{label:"Max",type:"number",size:"small",value:h,sx:{display:"table-cell",gridRow:"1",gridColumn:"span 1",verticalAlign:"middle",input:{color:(0,v.Q)(e.index)},label:{color:(0,v.Q)(e.index)}},InputLabelProps:{shrink:!0},onChange:e=>{let t=+e.target.value;t>m&&w(t)}}),(0,r.jsx)(c.A,{"aria-label":"Delete "+d+" slider",sx:{display:"table-cell",gridRow:"1",gridColumn:"span 1",color:v.theme.palette.dracula.foreground,verticalAlign:"middle",lineHeight:"0",padding:"0px",marginLeft:"2em",marginRight:"8px",minWidth:"32px"},onClick:()=>{e.deleteCallback(e.uuid)},children:(0,r.jsx)(i.A,{})})]})};function _(){let e=(0,f.A)(),[t,a]=(0,b.useState)(0),[i,g]=(0,x.fp)(y.wM),[m,h]=(0,x.fp)(y.G),v=(0,x.Xr)(y.DK),k=e=>{e&&h(m.set(e.getUUID(),e))},R=e=>{h(t=>(t.delete(e),t)),a(t-1),v(!0)};(0,b.useEffect)(()=>{i&&(a([...m.keys()].length),g(!1),v(!0))});let A=t>0?(0,r.jsx)("span",{style:{color:e.palette.dracula.foreground},children:"Uniforms [".concat(t,"]")}):(0,r.jsx)("span",{style:{color:e.status.disabled},children:"Uniforms"});return(0,r.jsxs)(o.A,{sx:{color:e.palette.dracula.foreground,backgroundColor:e.palette.primary.darker},children:[(0,r.jsx)(d.A,{sx:{fontSize:14},expandIcon:(0,r.jsx)(l.A,{sx:{color:e.palette.dracula.foreground}}),"aria-controls":"uniform-accordion",id:"uniform-accordion",children:A}),(0,r.jsx)(s.A,{sx:{padding:"0px 2px 8px"},children:(0,r.jsxs)(u.A,{sx:{maxHeight:"30vh",overflow:"auto"},children:[(0,r.jsx)(p.A,{spacing:2,direction:"column",sx:{mb:1},alignItems:"center",marginTop:"32px",children:[...m.keys()].map((e,t)=>(0,r.jsx)(U,{uuid:e,index:t,sliderRefMap:m,setRefCallback:k,deleteC
1allback:R},e))}),t<32?(0,r.jsx)(c.A,{sx:{color:e.palette.primary.light,padding:"0px"},onClick:()=>{var e;(e=(0,w.A)())&&h(m.set(e,{getVal:()=>0,getUniform:()=>"uniform_"+(t+1),getUUID:()=>e,getMaxRange:()=>1,getMinRange:()=>0})),a(t+1),v(!0)},children:(0,r.jsx)(n.A,{})}):null]})})]})}},98384:e=>{e.exports="@compute @workgroup_size(16, 16)\nfn main_image(@builtin(global_invocation_id) id: vec3u) {\n // Viewport resolution (in pixels)\n let screen_size = textureDimensions(screen);\n\n // Prevent overdraw for workgroups on the edge of the viewport\n if (id.x >= screen_size.x || id.y >= screen_size.y) { return; }\n\n // Pixel coordinates (centre of pixel, origin at bottom left)\n let fragCoord = vec2f(f32(id.x) + .5, f32(screen_size.y - id.y) - .5);\n\n // Normalised pixel coordinates (from 0 to 1)\n let uv = fragCoord / vec2f(screen_size);\n\n // Time varying pixel colour\n var col = .5 + .5 * cos(time.elapsed + uv.xyx + vec3f(0.,2.,4.));\n\n // Convert from gamma-encoded to linear colour space\n col = pow(col, vec3f(2.2));\n\n // Output to screen (linear colour space)\n textureStore(screen, id.xy, vec4f(col, 1.));\n}\n"},99297:(e,t,a)=>{a.d(t,{A:()=>p,K:()=>g});var r=a(80074),n=a(77202),i=a(20448),l=a(26148),o=a(12115),s=a(1894),d=a(15376).Buffer;let u=(e,t,a,r)=>({id:e,needsRedirect:t,success:a,message:null!=r?r:void 0}),c=e=>[...e.keys()].map(t=>({name:e.get(t).getUniform(),value:e.get(t).getVal(),minRange:e.get(t).getMinRange(),maxRange:e.get(t).getMaxRange()})),g=()=>{let e=(0,i.AY)(l.ge),t=(0,i.AY)(l.YX),a=(0,i.AY)(l.RM),r=(0,i.AY)(l.qQ),n=(0,i.AY)(l.aY),o=(0,i.AY)(l.au),s=(0,i.AY)(l.fn),d=(0,i.AY)(l.rl),u=(0,i.AY)(l.wM),c=(0,i.AY)(l.sW),g=(0,i.AY)(l.EP),p=(0,i.AY)(l.n0),m=(0,i.AY)(l.an);return()=>{e(),t(),a(),r(),n(),o(),s(),d(),u(),c(),g(),p(),m()}};function p(e){let t=(()=>{let e=(0,o.useRef)(null),t=(0,o.useMemo)(()=>(0,r.eU)(t=>{e.current=t}),[]);return(0,n.md)(t),e.current})(),a=(0,n.Xr)(l.d6),i=async(t,a)=>{let{data:r,error:n}=await e.auth.getUser();if(n||!(null==r?void 0:r.user))throw n;let i="".concat(r.user.id,"/").concat(t,".").concat("jpg"),l=d.from(a.replace("data:image/jpeg;base64,",""),"base64"),{error:o}=await e.storage.from("shaderthumb").upload(i,l,{contentType:"image/jpeg",upsert:!0});if(o)throw o;let{error:s}=await e.from("shader").update({thumb_url:i}).eq("id",t);if(s)throw s},g=async r=>{try{let{data:n,error:o,status:d}=await e.from("shader").insert([{author:null,name:t(l.qQ),description:t(l.aY),visibility:t(l.au),body:JSON.stringify({code:JSON.stringify(t(l.RM)),uniforms:c(t(l.G)),textures:t(l.fn),float32Enabled:t(l.EP),screenHDRFormat:t(l.n0),language:t(l.an)})}]).select().single();if(o&&406!==d)throw o;if(n)return await i(n.id,r),a(s.theme.palette.dracula.green),u(n.id,!0,!0);return a(s.theme.palette.dracula.red),u(null,!1,!1,"No data returned on creation")}catch(e){return alert(e.message),a(s.theme.palette.dracula.red),u(null,!1,!1,e.message)}},p=async(r,n)=>{try{let{error:o,status:d}=await e.from("shader").update({name:t(l.qQ),description:t(l.aY),visibility:t(l.au),body:JSON.stringify({code:JSON.stringify(t(l.RM)),uniforms:c(t(l.G)),textures:t(l.fn),float32Enabled:t(l.EP),screenHDRFormat:t(l.n0),language:t(l.an)})}).eq("id",r).single();if(o&&406!==d)throw o;return await i(r,n),a(s.theme.palette.dracula.green),u(r,!1,!0)}catch(e){return alert(e.message),a(s.theme.palette.dracula.red),u(r,!1,!1,e.message)}};return[void 0,async(e,a)=>t(l.YX)&&!a?p(t(l.YX),e):g(e),async t=>{try{let{error:a,status:r}=await e.from("shader").delete().eq("id",t);if(!a||406===r)return!0;throw a}catch(e){return alert(e.message),!1}}]}}}]);
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.