1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{3454:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(7663)},5557:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(9828)}])},2184:function(e,t,n){"use strict";n.r(t);var r=n(5893),i=n(7294),s=n(5675),o=n.n(s),a=n(7633),l=n(6485);t.default=()=>{let{artworks:e,inProgress:t,revealImage:n,setRevealImage:s,reset:c,hideReset:u}=(0,i.useContext)(l.zX),d=(e,t)=>{s(n.map((n,r)=>r===e?t:n))},h=e=>{e.preventDefault();let t=new FormData(e.target).get("index");"0"===t?d(0,!0):"1"===t?d(1,!0):d(2,!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid md:grid-cols-3 gap-x-2 mb-4",children:e.map((e,i)=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("h2",{className:"font-bold font-xl mb-4 text-pink-600",children:["Artwork Number ",i+1]}),(0,r.jsxs)("div",{className:n[i]?"hidden":"bg-pink-600 min-h-[24rem] w-full text-white p-4 flex",children:[(0,r.jsxs)("div",{className:t||n.some(e=>!0===e)||c?"hidden":null,children:[(0,r.jsx)("span",{className:"font-bold",children:e.answer?"Answer: ":null}),(0,r.jsx)("span",{className:"font-bold answer-container",children:e.answer?'"':null}),(0,r.jsx)("span",{className:"answer-container",children:e.answer?e.answer:null}),(0,r.jsx)("span",{className:"mt-4 font-bold answer-container",children:e.answer?'"':null})]}),(0,r.jsxs)("form",{onSubmit:h,className:"self-center m-auto",children:[(0,r.jsx)("input",{type:"hidden",value:i,name:"index"}),(0,r.jsx)("button",{className:n.some(e=>!0===e)?"rounded bg-white text-pink-600 p-2 hover:bg-gray-200":"hidden",children:"Reveal"})]})]}),(0,r.jsx)("div",{className:n[i]?"bg-pink-600 min-h-[24rem] w-full p-4 flex items-center justify-center":"hidden",children:(0,r.jsx)("a",{href:"".concat("https://www.nga.gov/collection/art-object-page",".").concat(e.objectID,".html"),target:"_blank",children:(0,r.jsx)(o(),{src:e.primaryImage,alt:"",width:"200",height:"140"})})})]},i))}),!u&&(0,r.jsx)(a.default,{})]})}},1097:function(e,t,n){"use strict";n.r(t);var r=n(5893),i=n(7294),s=n(6485),o=n(8583);t.default=()=>{let{inProgress:e,setRevealImage:t,buttonDisabled:n,setButtonDisabled:a,setHideReset:l,showConfetti:c,setShowConfetti:u}=(0,i.useContext)(s.zX);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),a(!0),l(!1),u(!0);let n=new FormData(e.target).get("finalOptions");"Number 1"===n?t([!0,!1,!1]):"Number 2"===n?t([!1,!0,!1]):t([!1,!1,!0])},className:e?"hidden":"mb-4",children:[(0,r.jsxs)("p",{className:"mb-2",children:["Will you pick ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 1"}),", ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 2"}),", or ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 3"}),"? The choice is yours!"]}),["Number 1","Number 2","Number 3"].map((e,t)=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{type:"radio",id:e,name:"finalOptions",value:e,disabled:n}),(0,r.jsx)("label",{htmlFor:e,children:e})]},t)),(0,r.jsx)("button",{type:"submit",className:n?"rounded bg-pink-800 text-white p-2":"rounded bg-pink-600 text-white p-2 hover:bg-pink-800",disabled:n,children:"Submit"})]}),c&&(0,r.jsx)(o.Z,{})]})}},5870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return c}});var r=n(5893),i=n(7294),s=n(3454);let o=async(e,t,n,r,i,o,a,l,c,u,d,h)=>{let m=s.env.OPENAI_API_KEY;try{let s=[];t.forEach(e=>{let t={title:e.title,attribution:e.attribution};s.push(t)});let p=await fetch("/api/generateAnswers",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(m)},body:JSON.stringify({prompt:e,artworks:s})}),f=await p.json(),x=t.map((e,t)=>{let n=f[t];return{...e,answer:n}});if(n(x),i>1?o(i-1):1===i&&o("Final"),console.log(f),r(!1),0===a||1===a||2===a){let e=c.filter(function(e){return e!==c[a]});e=[...e.slice(0,a),d[0],...e.slice(a)];let t=d.filter(function(e){return e!==d[0]});h(t),u(e)}l(void 0)}catch(e){console.error("Error:",e)}};var a=n(1097),l=n(6485),c=()=>{let{artworks:e,setArtworks:t,inProgress:n,setInProgress:s,remainingQuestions:c,setRemainingQuestions:u,setReset:d,selectedOption:h,setSelectedOption:m,questions:p,setQuestions:f,backupQuestions:x,setBackupQuestions:b}=(0,i.useContext)(l.zX),v=(0,i.useRef)(),g=(0,i.useRef)(),j=e=>{m(e),k(!1)},[y,w]=(0,i.useState)(""),[N,k]=(0,i.useState)(!1),T=e=>{w(e.target.value),k(e.target.checked),v.current.focus(),m(p.length+1)};return(0,r.jsxs)("div",{children:[("Final"!==c||"Final"===c&&n)&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2",children:[(0,r.jsx)("span",{className:"text-pink-600 text-xl font-bold",children:1!==c?"".concat(c," "):"Final "}),1!==c?"Questions Remaining":"Question"]}),(0,r.jsxs)("form",{onSubmit:n=>{n.preventDefault(),s(!0),d(!1),o(new FormData(n.target).get("radioOptions"),e,t,s,c,u,h,m,p,f,x,b),w("")},className:"mb-4",children:[p.map((e,t)=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{type:"radio",id:"question-".concat(t),name:"radioOptions",value:e,className:"mr-2",required:!0,disabled:n,checked:t===h,onChange:()=>j(t)}),(0,r.jsx)("label",{htmlFor:"question-".concat(t),children:e})]},t)),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{ref:g,type:"radio",id:"customQuestion",name:"radioOptions",value:y,onChange:T,className:"mr-2",required:!0,disabled:n}),(0,r.jsx)("label",{htmlFor:"customQuestion",children:"Other:"}),(0,r.jsx)("input",{ref:v,type:"text",id:"customQuestionInput",value:y,onChange:T,className:"ml-2 p-0.5 w-60",required:N,placeholder:"e.g. Do you like pi\xf1a coladas?",disabled:n,onFocus:()=>{g.current.checked=!0}})]}),(0,r.jsx)("button",{type:"submit",className:n?"rounded bg-pink-800 text-white p-2":"rounded bg-pink-600 text-white p-2 hover:bg-pink-800",disabled:n,children:n?"Holding on for Love...":"Ask Question"})]})]}
1),(0,r.jsx)("p",{className:n?"mb-4 text-pink-600 font-bold":"hidden",children:"Please give the artworks some time to think of their replies... it may take a while."}),"Final"===c&&!n&&(0,r.jsx)(a.default,{})]})}},7633:function(e,t,n){"use strict";n.r(t);var r=n(5893),i=n(7294),s=n(6485);t.default=()=>{let{setRevealImage:e,setRemainingQuestions:t,setReset:n,setHideReset:o,setSelectedOption:a,setButtonDisabled:l,setShowConfetti:c,setQuestions:u,setBackupQuestions:d}=(0,i.useContext)(s.zX);return(0,r.jsx)("form",{onSubmit:r=>{r.preventDefault(),e([!1,!1,!1]),t(3),n(!0),o(!0),a(void 0),l(!1),c(!1),u(["I love spending time looking at beautiful scenery, do you think I'll enjoy looking at you?","My home is filled with interesting objects that each have a unique story, do you think you'd fit in there?","I'm drawn to thought-provoking and emotionally charged art. Can you evoke strong feelings or reflections in me?"]),d(["I find myself captivated by vibrant and lively atmospheres. Does your presence bring a burst of energy and color that could light up my space?","Quiet evenings with a good book are my sanctuary. Would your essence add to the tranquility and depth of such moments in my life?","I have a passion for stories and narratives that span different cultures and times. Do you carry tales or inspirations from far-off places or eras?"])},children:(0,r.jsx)("button",{className:"rounded bg-pink-600 text-white p-2 hover:bg-pink-800",children:"Reset"})})}},9828:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(5893),i=n(5870),s=n(2184);function o(){return(0,r.jsxs)("div",{className:"container mt-10 mx-auto mb-10 p-4",children:[(0,r.jsx)("h1",{className:"mb-4 text-2xl font-bold text-pink-600",children:"Art of Attraction"}),(0,r.jsxs)("p",{className:"mb-2",children:[(0,r.jsx)("span",{className:"font-bold text-pink-600",children:"How to use:\xa0"}),"Ask three hidden artworks three questions, then pick your favourite based on their replies!"]}),(0,r.jsx)(i.default,{}),(0,r.jsx)(s.default,{})]})}},7663:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u<t;)r&&r[u].run();u=-1,t=l.length}r=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),1!==l.length||c||a(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,r),o=!1}finally{o&&delete n[e]}return s.exports}r.ab="//";var i=r(229);e.exports=i}()}},function(e){e.O(0,[583,675,888,774,179],function(){return e(e.s=5557)}),_N_E=e.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.