(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7208],{20727:function(t,e,n){"use strict";n.d(e,{Y:function(){return o},Z:function(){return r}}),n(72131),n(2382);var r="_1soa3zv1 qz91c32nu qz91c3gu",o="_1soa3zv0"},51570:function(t,e,n){"use strict";n.d(e,{h:function(){return c}});var r=n(97458),o=n(10110),a=n.n(o);n(52983);var i=n(99123);let c=t=>{let{title:e,type:n,slug:o,image:c,description:s,farcaster:l}=t;return(0,r.jsxs)(a(),{children:[(0,r.jsx)("title",{children:"Nouns Builder | ".concat(e)}),(0,r.jsx)("meta",{property:"og:title",content:e}),(0,r.jsx)("meta",{property:"og:type",content:n}),(0,r.jsx)("meta",{property:"og:url",content:"https://nouns.build".concat(o)}),(0,r.jsx)("meta",{property:"og:image",content:c||"https://nouns.build/social-preview.jpg"}),(0,r.jsx)("meta",{property:"og:description",content:s||"Unlock the possibilities of collective creation. Start with a vision. Start a DAO. All onchain."}),i.Qh&&(0,r.jsx)("meta",{name:"robots",content:"noindex"}),(0,r.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,r.jsx)("meta",{name:"twitter:site",content:"@nounsbuilder"}),(0,r.jsx)("meta",{name:"twitter:creator",content:"@nounsbuilder"}),(0,r.jsx)("meta",{name:"twitter:title",content:e}),(0,r.jsx)("meta",{name:"twitter:url",content:"https://nouns.build".concat(o)}),(0,r.jsx)("meta",{name:"twitter:description",content:s||"Unlock the possibilities of collective creation. Start with a vision. Start a DAO. All onchain."}),(0,r.jsx)("meta",{name:"twitter:image",content:c||"https://nouns.build/social-preview.jpg"}),l&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("meta",{property:"eth:nft:collection",content:l.name}),(0,r.jsx)("meta",{property:"eth:nft:contract_address",content:l.contractAddress}),(0,r.jsx)("meta",{property:"eth:nft:creator_address",content:l.contractAddress}),(0,r.jsx)("meta",{property:"eth:nft:schema",content:"erc721"}),(0,r.jsx)("meta",{property:"eth:nft:chain",content:l.chain.slug}),(0,r.jsx)("meta",{property:"eth:nft:media_url",content:l.image||"https://nouns.build/social-preview.jpg"})]})]})}},24345:function(t,e,n){"use strict";n.d(e,{a:function(){return c}});var r=n(73474),o=n.n(r),a=n(52983),i=n(93185);let c=(t,e)=>{let[n,r]=(0,a.useState)(o().unix(Date.now()/1e3)),[c,s]=(0,a.useState)(!0);(0,i.Y)(()=>{r(o().unix(Date.now()/1e3))},c?1e3:null);let l=o().unix(t),u=l.diff(n,"second");return(0,a.useEffect)(()=>{n>=l&&(s(!1),e())},[n,l,e]),{isEnded:n>=l,countdownString:"".concat(Math.floor(u/3600),"h ").concat(Math.floor(u%3600/60),"m ").concat(u%60,"s"),countdownStringDays:u>172800?"".concat(Math.floor(u/86400)," days"):"".concat(Math.floor(u/3600).toString().padStart(2,"0"),"h ").concat(Math.floor(u%3600/60).toString().padStart(2,"0"),"m ").concat((u%60).toString().padStart(2,"0"),"s")}}},93185:function(t,e,n){"use strict";n.d(e,{Y:function(){return o}});var r=n(52983);function o(t,e){let n=(0,r.useRef)();(0,r.useEffect)(()=>{n.current=t},[t]),(0,r.useEffect)(()=>{if(null!==e){let t=setInterval(function(){for(var t,e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];return null===(t=n.current)||void 0===t?void 0:t.call(n,...r)},e);return()=>clearInterval(t)}},[e])}},18986:function(t,e,n){"use strict";n.d(e,{t:function(){return o}});var r=n(52983);function o(){let[t,e]=r.useState(!1);return r.useEffect(()=>{e(!0)},[]),t}},46229:function(t,e,n){"use strict";n.d(e,{K:function(){return v}});var r=n(97458),o=n(45341),a=n(73474),i=n.n(a),c=n(42494),s=n(22030),l=n.n(s),u=n(48260),d=n.n(u),p=n(52983),f=n(99123),h=n(24345),x=n(18986),m=n(70187);n(67545);var g="_1c083am3 qz91c33qo qz91c33x0";let j=t=>{let{title:e,content:n}=t;return(0,r.jsxs)(o.Flex,{direction:"column",p:"x4",className:"_1c083am5",children:[(0,r.jsx)(o.Paragraph,{color:"text3",children:e}),(0,r.jsx)(o.Text,{variant:"label-md",children:n})]})},y=t=>{let{end:e,onEnd:n}=t,{countdownString:o}=(0,h.a)(e,n);return(0,r.jsx)(j,{title:"Ends in",content:o})},v=t=>{let{collectionAddress:e,chainId:n,tokenName:a,tokenImage:s,tokenId:u,collectionName:h,bid:v,endTime:b}=t,w=(0,x.t)(),[S,E]=p.useState(!1),[k,T]=(0,p.useState)(!1);if(!w)return null;let B=!b||i().unix(Date.now()/1e3)>=i().unix(b),A=f.fb.find(t=>t.id===n);return(0,r.jsx)(d(),{href:"/dao/".concat(null==A?void 0:A.slug,"/").concat(e,"/").concat(u),prefetch:!1,children:(0,r.jsxs)(o.Box,{borderRadius:"curved",height:"100%",overflow:"hidden",children:[(0,r.jsx)(o.Box,{backgroundColor:"background2",width:"100%",height:"auto",aspectRatio:1,position:"relative",className:"_1c083am0",children:s?(0,r.jsx)(l(),{priority:!0,unoptimized:!0,layout:"fill",src:S?"/ImageError.svg":(0,c.dN)(s)||"",onError:()=>{E(!0)},sizes:"100vw",alt:"".concat(h," image")}):(0,r.jsx)(l(),{priority:!0,layout:"fill",src:"/ImageError.svg",alt:"Error image"})}),(0,r.jsxs)(o.Box,{pt:"x4",position:"relative",overflow:"hidden",className:"_1c083am1",children:[!!a&&(0,r.jsx)(o.Flex,{width:"100%",minW:"x0",children:(0,r.jsx)(o.Box,{"data-testid":"token-name",px:"x4",minW:"x0",children:(0,r.jsx)(o.Box,{mb:"x1",style:{fontSize:22},fontWeight:"display",className:g,children:a})})}),!!h&&(0,r.jsx)(o.Paragraph,{"data-testid":"collection-name",color:"text3",mb:"x4",px:"x4",className:g,children:h})]}),(0,r.jsx)(o.Flex,{direction:"row",width:"100%",className:"_1c083am4 _1c083am1",children:k||B?(0,r.jsx)(j,{title:"Winning bid",content:v?"".concat((0,m.z)(v)," ETH"):"n/a"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j,{title:"Highest bid",content:v?"".concat((0,m.z)(v)," ETH"):"0.00 ETH"}),(0,r.jsx)(y,{end:b,onEnd:()=>{T(!0)}})]})})]})})}},7784:function(t,e,n){"use strict";var r=n(97458),o=n(45341),a=n(48260),i=n.n(a);n(52983),e.Z=()=>(0,r.jsxs)(o.Flex,{direction:"column",align:"center",style:{maxWidth:912,minHeight:500,padding:"150px 0px"},gap:"x4",children:[(0,r.jsx)(o.Text,{variant:"paragraph-md",color:"tertiary",children:"There are no DAOs here"}),(0,r.jsx)(i(),{href:"/create",passHref:!0,children:(0,r.jsx)(o.Flex,{as:"button",backgroundColor:"border",borderRadius:"normal",borderColor:"border",borderStyle:"solid",borderWidth:"normal",fontWeight:"display",cursor:"pointer",px:"x4",py:"x2",mx:"x1",children:"Create a DAO"})})]})},46239:function(t,e,n){"use strict";n.d(e,{e:function(){return i}});var r=n(97458),o=n(45341),a=n(20727);let i=()=>(0,r.jsx)(o.Grid,{className:a.Z,mb:"x6",h:"100%",children:Array(6).fill(0).map((t,e)=>(0,r.jsx)(o.Box,{borderRadius:"curved",backgroundColor:"background2",width:"100%",aspectRatio:1,position:"relative",className:a.Y},e))})},49960:function(t,e,n){"use strict";n.d(e,{Z:function(){return f}});var r=n(97458),o=n(45341),a=n(48260),i=n.n(a),c=n(31530),s=n(52983),l=n(72613),u=n(80968);let d={[u.t3.StartTime]:"Created",[u.t3.HighestBidAmount]:"Price",[u.t3.EndTime]:"Ending"};var p=t=>{let{choice:e}=t,n=(0,c.useRouter)(),a=s.useCallback(t=>{switch(t){case"Created":return u.t3.StartTime;case"Price":return u.t3.HighestBidAmount;case"Ending":return u.t3.EndTime;default:throw Error("Invalid sort key")}},[]),i=s.useCallback(t=>{n.push({pathname:n.pathname,query:{...n.query,orderBy:a(t.target.value)}})},[n,a]);return(0,r.jsx)(o.Flex,{w:"auto",children:(0,r.jsx)(o.Select,{name:"Explore Sort",defaultValue:n.query.sortKey?d[null==n?void 0:n.query.sortKey]:"Created",fontSize:16,onChange:t=>i(t),children:Object.values(d).map(t=>(0,r.jsx)("option",{value:t,children:t},t))})})},f=t=>{var e;let{title:n,showSort:a=!1}=t,s=(0,c.useRouter)(),{address:u}=(0,l.mA)();return(0,r.jsxs)(o.Flex,{direction:"column",w:"100%",mb:u?"x0":"x5",align:"center",style:{maxWidth:912},children:[(0,r.jsxs)(o.Flex,{direction:"row",w:"100%",justify:"space-between",children:[(0,r.jsx)(o.Box,{fontSize:28,fontWeight:"heading",mb:"x8",children:n}),a&&(0,r.jsx)(p,{choice:(null===(e=s.query)||void 0===e?void 0:e.sortKey)||"CREATED"})]}),u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.Flex,{w:"100%",justify:"center",children:[(0,r.jsx)(i(),{href:"/explore",passHref:!0,children:(0,r.jsx)(o.Box,{h:"100%",mb:"x4",mx:"x4",style:{borderBottom:"/explore"===s.pathname?"2px solid black":"0px"},children:(0,r.jsx)(o.Text,{variant:"paragraph-md",children:"Explore"})})}),(0,r.jsx)(i(),{href:"/mydaos",passHref:!0,children:(0,r.jsx)(o.Box,{h:"100%",mb:"x4",mx:"x4",style:{borderBottom:"/mydaos"===s.pathname?"2px solid black":"0px"},children:(0,r.jsx)(o.Text,{variant:"paragraph-md",children:"My DAOs"})})})]}),(0,r.jsx)(o.Box,{w:"100vw",mb:"x5",style:{borderBottom:"2px solid ".concat(o.vars.color.border)}})]})]})}},42494:function(t,e,n){"use strict";n.d(e,{dN:function(){return m},vs:function(){return p},BQ:function(){return l},cT:function(){return s}});var r=n(23050);function o(t){let e=r.createHash("sha256");for(let n of t){let t={name:n.name,lastModified:n.lastModified,size:n.size,type:n.type};e.update(JSON.stringify(t))}return"0x".concat(e.digest("hex"))}let a={onProgress:void 0,cache:!0};function i(t,e){return new Promise(async(n,r)=>{let o=new XMLHttpRequest,a=await fetch("/api/upload-key",{method:"POST",headers:{accept:"application/json"}});a.ok||r("No KEY");let{JWT:i}=await a.json();o.open("POST","https://api.pinata.cloud/pinning/pinFileToIPFS",!0),o.setRequestHeader("Authorization","Bearer ".concat(i)),o.upload.onprogress=t=>{t.lengthComputable&&e(t.loaded/t.total*100)},o.onload=()=>{o.status>=200&&o.status<300?n(JSON.parse(o.responseText)):r(Error("Upload failed with status: ".concat(o.status)))},o.onerror=()=>{r(Error("An error occurred during the upload."))},o.send(t)})}let c={prefix:"ZORA/IPFSUploadCache",get(t){let e=o(t);try{let t=localStorage.getItem("".concat(this.prefix,"/").concat(e));if(console.log("ipfs-service/uploadCache",t?"HIT":"MISS",e,t),t)return{cid:t,uri:"ipfs://".concat(t)}}catch(t){}},put(t,e){let n=o(t);try{localStorage.setItem("".concat(this.prefix,"/").concat(n),e)}catch(t){}}};async function s(t,e){let{onProgress:n,cache:r}={...a,...e};if(r){let e=c.get([t]);if(e)return e}let o=new FormData;o.append("file",t);let s=await i(o,t=>{console.log("Upload progress: ".concat(t,"%")),"function"==typeof n&&n(t)});console.log({response:s});let l=s.IpfsHash.toString(),u="ipfs://".concat(l);return console.info("ipfs-service/upload",{cid:l,uri:u}),c.put([t],l),{cid:l,uri:u}}async function l(t,e){let n=t.map(t=>t instanceof File?{content:t,path:t.name}:t),r=n.map(t=>t.content),{onProgress:o,cache:s}={...a,...e};if(s){let t=c.get(r);if(t)return t}let l=new FormData;n.forEach(t=>{console.log({file:t}),l.append("file",t.content,"builder/".concat(t.path))}),l.append("pinataOptions",JSON.stringify({cidVersion:1})),l.append("pinataMetadata",JSON.stringify({name:"builder"}));let u=await i(l,t=>{console.log("Upload progress: ".concat(t,"%")),"function"==typeof o&&o(t)});console.log({response:u});let d=u.IpfsHash.toString(),p="ipfs://".concat(d);return console.info("ipfs-service/uploadDirectory",{cid:d}),c.put(r,d),{uri:p,cid:d}}var u=n(90913);function d(t){if(!t)return!1;try{return u.k.parse(t),!0}catch(e){if(/^(bafy|Qm)/.test(t))return!0;return!1}}function p(t){if(!t||"string"!=typeof t)return null;if(f(t=t.replace(/"/g,"")))return t;if(d(t))return"ipfs://".concat(t);if(!x(t))return null;if(h(t)){let e=new URL(t);e.pathname=e.pathname.replace(/^\/ipfs\//,"");let n=e.toString().replace("".concat(e.protocol,"//").concat(e.host,"/"),"");return"ipfs://".concat(n)}return null}function f(t){return!!t&&"string"==typeof t&&t.startsWith("ipfs://")}function h(t){return!!t&&"string"==typeof t&&!f(t)&&!!t.match(/\/ipfs\//)}function x(t){return!!t&&(f(t)||h(t))}function m(t){if(t&&"string"==typeof t){if(t&&(x(t)||d(t)))return function(t){if(!t||"string"!=typeof t)return;let e=p(t);if(e)return e.replace("ipfs://","".concat("https://ipfs.decentralized-content.com","/ipfs/"))}(t);if(/^(https|data|blob):/.test(t))return t}}},67545:function(){},2382:function(){},72131:function(){},10110:function(t,e,n){t.exports=n(25466)}}]);