"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[736],{14936:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(57437),i=r(2265),a=r(44379),o=r(55748);let s=e=>{let{selectedDate:t}=e,r=(0,i.useMemo)(()=>(0,o.Fw)(t),[t]);return(0,n.jsx)("group",{children:null!==r&&(0,n.jsx)(a.x,{position:[0,-1,0],fontSize:.5,color:"yellow",anchorX:"center",anchorY:"middle",children:r})})}},73452:function(e,t,r){r.d(t,{O:function(){return j}});var n=r(57437),i=r(2265),a=r(1238),o=r(24837),s=r(70854),l=r(32325),c=r(22170),u=r.n(c);let d=(e,t,r)=>(1-r)*e+r*t,h=e=>{var t;let{content:r,image:c,index:h,isActive:f,currentFrame:m,color:p,initialPosition:x,onPositionChange:g,isView:y=!1}=e,b=(0,s.mE)(c),[j,w]=(0,i.useState)(!1),[v,M]=(0,i.useState)(!1),S={width:2,height:3.3},[z,F]=(0,i.useState)((null==x?void 0:x.size)?{width:x.size[0],height:x.size[1]}:S),A=(0,i.useRef)(z),C=(0,i.useRef)(null),E=(0,i.useRef)(null),I=(0,i.useRef)(null),{camera:P,size:B}=(0,a.D)(),[k,D]=(0,i.useState)((null==x?void 0:x.htmlPosition)||[0,-(.4*z.height),.01]),R=(null==x?void 0:null===(t=x.size)||void 0===t?void 0:t[2])||.1,{rotation:_,position:U,scale:G}=(0,o.q_)({rotation:!f||j||v?[0,0,0]:[0,(h-m)*.3,0],position:!f||j||v?[0,0,0]:[(h-m)*2.2,.3*Math.sin((h-m)*.5),-((h-m)*.5)],scale:!f||j||v?.5:1,config:{mass:1,tension:280,friction:60}}),T=(0,i.useCallback)(u()(e=>{g(e)},200),[g]);(0,i.useEffect)(()=>{T({size:[z.width,z.height,R],htmlPosition:k})},[z,k,R,T]),(0,i.useEffect)(()=>()=>{T.cancel()},[T]);let V=(0,i.useCallback)(e=>{if(y)return;e.stopPropagation(),w(!0);let{clientX:t,clientY:r}=e;E.current={x:t,y:r}},[y]),N=(0,i.useCallback)(()=>{y||(w(!1),M(!1),E.current=null,I.current=null)},[y]),L=(0,i.useCallback)(e=>{if(!y){if(j&&C.current&&E.current){e.stopPropagation();let{clientX:t,clientY:r}=e,n="aspect"in P?P.aspect:1,i=(t-E.current.x)/B.width*n*P.position.z*2,a=(E.current.y-r)/B.height*P.position.z*2;A.current={width:Math.max(S.width,A.current.width+i),height:Math.max(S.height,A.current.height+a)},E.current={x:t,y:r}}else if(v&&I.current){e.stopPropagation();let{clientX:t,clientY:r}=e,n="aspect"in P?P.aspect:1,i=(t-I.current.x)/B.width*n*P.position.z*2,a=(I.current.y-r)/B.height*P.position.z*2;D(e=>[e[0]+i,e[1]+a,e[2]]),I.current={x:t,y:r}}}},[j,v,P,S,B,y]);i.useEffect(()=>{if(j&&!y){let e=setInterval(()=>{F(e=>({width:d(e.width,A.current.width,.2),height:d(e.height,A.current.height,.2)}))},16);return()=>clearInterval(e)}},[j,y]);let J=(0,i.useCallback)(e=>{if(y)return;e.stopPropagation(),M(!0);let{clientX:t,clientY:r}=e;I.current={x:t,y:r}},[y]);return(0,n.jsxs)(o.q.group,{rotation:_,position:U,scale:G,children:[(0,n.jsxs)("mesh",{ref:C,onPointerDown:V,onPointerUp:N,onPointerMove:L,onPointerLeave:N,children:[(0,n.jsx)("boxGeometry",{args:[z.width,z.height,R]}),(0,n.jsx)("meshStandardMaterial",{map:b,transparent:!0,roughness:.1,metalness:.5})]}),(0,n.jsx)(l.V,{position:k,transform:!0,zIndexRange:[1,0],children:(0,n.jsx)("div",{style:{fontSize:"0.2em",lineHeight:"2.5em",textAlign:"center",color:"white",backgroundColor:p,cursor:y?"default":"move",userSelect:"none"},dangerouslySetInnerHTML:{__html:r},onPointerDown:J})}),j&&!y&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.V,{position:[z.width/2,z.height/2,0],children:(0,n.jsx)("div",{style:{cursor:"nwse-resize"},children:"↘"})}),(0,n.jsx)(l.V,{position:[-z.width/2,-z.height/2,0],children:(0,n.jsx)("div",{style:{cursor:"nwse-resize"},children:"↖"})}),(0,n.jsx)(l.V,{position:[z.width/2,-z.height/2,0],children:(0,n.jsx)("div",{style:{cursor:"nesw-resize"},children:"↙"})}),(0,n.jsx)(l.V,{position:[-z.width/2,z.height/2,0],children:(0,n.jsx)("div",{style:{cursor:"nesw-resize"},children:"↗"})}),(0,n.jsx)(l.V,{position:[0,z.height/2+.1,0],children:(0,n.jsx)("div",{style:{cursor:"ns-resize"},children:"↑↓"})}),(0,n.jsx)(l.V,{position:[z.width/2+.1,0,0],children:(0,n.jsx)("div",{style:{cursor:"ew-resize"},children:"←→"})}),(0,n.jsx)(l.V,{position:[0,-z.height/2-.1,0],children:(0,n.jsx)("div",{style:{cursor:"ns-resize"},children:"↓↑"})}),(0,n.jsx)(l.V,{position:[-z.width/2-.1,0,0],children:(0,n.jsx)("div",{style:{cursor:"ew-resize"},children:"→←"})})]})]})};var f=r(97776);let m=e=>{let t=document.createElement("canvas"),r=t.getContext("2d");if(r){t.width=256,t.height=256;let n=r.createRadialGradient(128,128,64,128,128,128);n.addColorStop(0,e),n.addColorStop(1,"rgba(255, 255, 255, 0.5)"),r.fillStyle=n,r.beginPath(),r.arc(128,128,128,0,2*Math.PI),r.fill()}return new f.CanvasTexture(t)},p=e=>{let t=document.createElement("canvas"),r=t.getContext("2d");if(r){t.width=256,t.height=256;for(let t=0;t<256;t+=20)r.fillStyle=t%40==0?e:"rgba(255, 255, 255, 0.5)",r.fillRect(t,0,20,256)}return new f.CanvasTexture(t)},x=e=>{let t=document.createElement("canvas"),r=t.getContext("2d");if(r){t.width=256,t.height=256,r.fillStyle=e,r.fillRect(0,0,256,256),r.fillStyle="rgba(255, 255, 255, 0.5)";for(let e=0;e<256;e+=40)for(let t=0;t<256;t+=40)r.beginPath(),r.arc(t+10,e+10,10,0,2*Math.PI),r.fill()}return new f.CanvasTexture(t)},g=e=>{let{position:t,texture:r,floatSpeed:o}=e,s=(0,i.useRef)(null);return(0,a.F)(()=>{s.current&&(s.current.position.y+=.01*o,s.current.position.y>t[1]+5&&(s.current.position.y=t[1]))}),(0,n.jsxs)("mesh",{ref:s,position:t,children:[(0,n.jsx)("sphereGeometry",{args:[.5,16,16]}),(0,n.jsx)("meshStandardMaterial",{map:r,transparent:!0,opacity:.9})]})},y=()=>{let e=(0,i.useMemo)(()=>{let e=[];for(let t=0;t<20;t++)e.push([(Math.random()-.5)*10,0,(Math.random()-.5)*10]);return e},[]),t=["#FF5733","#FFC300","#DAF7A6","#33FFBD","#FF33A1","#8E44AD","#2980B9","#E74C3C","#1ABC9C","#F39C12"],r=[m,p,x];return(0,n.jsx)(n.Fragment,{children:e.map((e,i)=>{let a=t[i%t.length],o=(0,r[i%r.length])(a);return(0,n.jsx)(g,{position:e,texture:o,floatSpeed:1+2*Math.random()},i)})})},b=()=>{let e=(0,i.useRef)(null),[t,r,o,s]=(0,i.useMemo)(()=>{let e=new Float32Array(300),t=new Float32Array(300),r=new Float32Array(100),n=new Float32Array(100);for(let i=0;i<100;i++){e[3*i]=(Math.random()-.5)*10,e[3*i+1]=10*Math.random(),e[3*i+2]=(Math.random()-.5)*10;let a=new f.Color().setHSL(Math.random(),1,.5);t[3*i]=a.r,t[3*i+1]=a.g,t[3*i+2]=a.b,r[i]=.2*Math.random()+.1,n[i]=Math.random()*Math.PI*2}return[e,t,r,n]},[100]);return(0,a.F)(()=>{if(e.current){let t=e.current.geometry.attributes.position.array,r=e.current.geometry.attributes.rotation.array;for(let e=0;e<100;e++){let n=3*e;t[n+1]-=.02,t[n]+=.01*Math.sin(.001*Date.now()+e),r[e]+=.01,t[n+1]<0&&(t[n+1]=10*Math.random(),t[n]=(Math.random()-.5)*10,t[n+2]=(Math.random()-.5)*10)}e.current.geometry.attributes.position.needsUpdate=!0,e.current.geometry.attributes.rotation.needsUpdate=!0}}),(0,n.jsxs)("points",{ref:e,children:[(0,n.jsxs)("bufferGeometry",{children:[(0,n.jsx)("bufferAttribute",{attach:"attributes-position",count:100,array:t,itemSize:3}),(0,n.jsx)("bufferAttribute",{attach:"attributes-color",count:100,array:r,itemSize:3}),(0,n.jsx)("bufferAttribute",{attach:"attributes-size",count:100,array:o,itemSize:1}),(0,n.jsx)("bufferAttribute",{attach:"attributes-rotation",count:100,array:s,itemSize:1})]}),(0,n.jsx)("pointsMaterial",{size:.1,vertexColors:!0})]})},j=e=>{let{frames:t,currentFrame:r,framePositions:o,onFramePositionChange:s,isView:l}=e,c=(0,i.useRef)(null);return(0,a.F)(e=>{c.current&&(c.current.rotation.y=.1*Math.sin(.5*e.clock.getElapsedTime()),c.current.position.y=.1*Math.sin(e.clock.getElapsedTime())+1)}),(0,n.jsxs)("group",{ref:c,children:[t.map((e,t)=>(0,n.jsx)(h,{content:e.content,image:e.image,index:t,isActive:!0,currentFrame:r,color:e.color,initialPosition:o[e.id],onPositionChange:t=>s(e.id,t),isView:l},e.id)),(0,n.jsx)(y,{}),(0,n.jsx)(b,{})]})}},6713:function(e,t,r){r.d(t,{H:function(){return o}});var n=r(57437),i=r(2265),a=r(1238);let o=()=>{let e=(0,i.useRef)(null);return(0,a.F)(()=>{e.current&&(e.current.rotation.y+=.01)}),(0,n.jsxs)("group",{ref:e,position:[0,-2,0],scale:.5,children:[(0,n.jsxs)("mesh",{position:[0,-.55,0],children:[(0,n.jsx)("cylinderGeometry",{args:[1.2,1.2,.1,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#d4af37"})]}),(0,n.jsxs)("mesh",{children:[(0,n.jsx)("cylinderGeometry",{args:[1,1,1,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ff9900"})]}),(0,n.jsxs)("mesh",{position:[0,.6,0],children:[(0,n.jsx)("cylinderGeometry",{args:[.9,.9,.2,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ffcc00"})]}),(0,n.jsxs)("mesh",{position:[0,.8,0],children:[(0,n.jsx)("cylinderGeometry",{args:[.8,.8,.4,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ff6699"})]}),Array.from({length:5}).map((e,t)=>(0,n.jsxs)("mesh",{position:[.6*Math.cos(2*t*Math.PI/5),1.1,.6*Math.sin(2*t*Math.PI/5)],children:[(0,n.jsx)("cylinderGeometry",{args:[.05,.05,.3,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ffffff"}),(0,n.jsxs)("mesh",{position:[0,.25,0],children:[(0,n.jsx)("coneGeometry",{args:[.05,.1,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ff9900"})]})]},t)),(0,n.jsxs)("mesh",{position:[0,1.2,0],children:[(0,n.jsx)("cylinderGeometry",{args:[.05,.05,.4,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ffffff"}),(0,n.jsxs)("mesh",{position:[0,.3,0],children:[(0,n.jsx)("coneGeometry",{args:[.05,.1,32]}),(0,n.jsx)("meshStandardMaterial",{color:"#ff9900"})]})]})]})}},97031:function(e,t,r){var n=r(57437);r(2265),t.Z=()=>(0,n.jsxs)("div",{className:"flex items-center justify-center h-screen bg-gradient-to-b from-purple-600 to-pink-500",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"w-20 h-20 border-purple-200 border-2 rounded-full"}),(0,n.jsx)("div",{className:"w-20 h-20 border-purple-700 border-t-2 animate-spin rounded-full absolute left-0 top-0"})]}),(0,n.jsx)("div",{className:"ml-4 text-white text-2xl font-semibold",children:"Loading..."})]})},91415:function(e,t,r){r.d(t,{u:function(){return s}});var n=r(57437),i=r(2265),a=r(1238),o=r(97776);let s=()=>{let e=(0,i.useRef)(null),[t,r]=(0,i.useMemo)(()=>{let e=new Float32Array(1500),t=new Float32Array(1500);for(let r=0;r<500;r++){e[3*r]=(Math.random()-.5)*20,e[3*r+1]=(Math.random()-.5)*20,e[3*r+2]=(Math.random()-.5)*20;let n=new o.Color().setHSL(.3*Math.random()+.4,1,.6);t[3*r]=n.r,t[3*r+1]=n.g,t[3*r+2]=n.b}return[e,t]},[500]);return(0,a.F)(t=>{let r=t.clock.getElapsedTime();if(e.current){let t=e.current.geometry.attributes.position.array;for(let e=0;e<500;e++){let n=3*e;t[n+1]+=.02*Math.sin(r+.1*e),t[n]+=.01*Math.sin(r+.1*e),t[n+2]+=.01*Math.cos(r+.1*e)}e.current.geometry.attributes.position.needsUpdate=!0}}),(0,n.jsxs)("points",{ref:e,children:[(0,n.jsxs)("bufferGeometry",{children:[(0,n.jsx)("bufferAttribute",{attach:"attributes-position",count:500,array:t,itemSize:3}),(0,n.jsx)("bufferAttribute",{attach:"attributes-color",count:500,array:r,itemSize:3})]}),(0,n.jsx)("pointsMaterial",{size:.1,vertexColors:!0})," "]})}},87871:function(e,t,r){r.d(t,{z:function(){return c}});var n=r(57437),i=r(2265),a=r(71538),o=r(12218),s=r(49354);let l=(0,o.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),c=i.forwardRef((e,t)=>{let{className:r,variant:i,size:o,asChild:c=!1,...u}=e,d=c?a.g7:"button";return(0,n.jsx)(d,{className:(0,s.cn)(l({variant:i,size:o,className:r})),ref:t,...u})});c.displayName="Button"},51224:function(e,t,r){r.d(t,{I8:function(){return d},db:function(){return u},tO:function(){return h}});var n=r(15236),i=r(69842),a=r(5186),o=r(99854),s=r(20357);let l={apiKey:"AIzaSyBhs_O5l0EYbTQ9cTDLGcW1Iux8lu2I474",authDomain:"gifts-a48ce.firebaseapp.com",databaseURL:s.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL,projectId:"gifts-a48ce",storageBucket:"gifts-a48ce.appspot.com",messagingSenderId:"50675640928",appId:"1:50675640928:web:924c85cd47d2ed5620b105",measurementId:s.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID},c=(0,n.C6)().length?(0,n.Mq)():(0,n.ZF)(l),u=(0,i.ad)(c),d=(0,a.v0)(c),h=(0,o.cF)(c)},29544:function(e,t,r){r.d(t,{Ag:function(){return f},Ix:function(){return h},MU:function(){return d},Yj:function(){return u},eK:function(){return c},iJ:function(){return m},mp:function(){return l},pz:function(){return p}});var n=r(51224),i=r(69842),a=r(99854),o=r(72107);let s="albums",l=async(e,t)=>{let{frames:r,dateOfBirth:a,musicUrl:o,framePositions:l}=t,c=(0,i.JU)((0,i.hJ)(n.db,s)),u={id:c.id,userId:e,frames:r,dateOfBirth:a?(0,i.Bt)():null,musicUrl:o,createdAt:(0,i.Bt)(),updatedAt:(0,i.Bt)(),state:"S",paymentStatus:"pending",framePositions:l};return await (0,i.pl)(c,u),c.id},c=async e=>{let t=(0,i.JU)(n.db,s,e),r=await (0,i.QT)(t);return r.exists()?r.data():null},u=async(e,t)=>{let r=(0,i.JU)(n.db,s,e);await (0,i.r7)(r,{...t,updatedAt:(0,i.Bt)()})},d=async e=>{let t=(0,i.IO)((0,i.hJ)(n.db,s),(0,i.ar)("userId","==",e));return(await (0,i.PL)(t)).docs.map(e=>e.data())},h=async(e,t,r,i)=>{let s=await (0,o.Z)(e,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),l=(0,a.iH)(n.tO,"".concat("album-images","/").concat(t,"/").concat(i,"/").concat(r));return await (0,a.KV)(l,s),(0,a.Jt)(l)},f=async(e,t,r)=>{let i=(0,a.iH)(n.tO,"".concat("album-music","/").concat(t,"/").concat(r));return await (0,a.KV)(i,e),(0,a.Jt)(i)},m=async(e,t)=>{let r=(0,i.JU)(n.db,s,e);await (0,i.r7)(r,{state:t,updatedAt:(0,i.Bt)()})},p=async(e,t)=>{let r=(0,i.JU)(n.db,s,e);await (0,i.r7)(r,{paymentStatus:t,updatedAt:(0,i.Bt)()})}},55748:function(e,t,r){r.d(t,{Fw:function(){return a},WS:function(){return o},kB:function(){return i}});var n=r(69842);let i=e=>e instanceof Date?e:e instanceof n.EK?e.toDate():null,a=e=>{let t=i(e);if(!t)return null;let r=new Date,n=r.getFullYear()-t.getFullYear(),a=r.getMonth()-t.getMonth();return(a<0||0===a&&r.getDate()<t.getDate())&&n--,n},o=e=>{let t=i(e);if(!t)return null;let r=new Date,n=new Date(r.getFullYear(),t.getMonth(),t.getDate());return n<r&&n.setFullYear(n.getFullYear()+1),n}},49354:function(e,t,r){r.d(t,{cn:function(){return a}});var n=r(44839),i=r(96164);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,i.m6)((0,n.W)(t))}}}]);