(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{4787:(e,r,t)=>{Promise.resolve().then(t.bind(t,7940))},7940:(e,r,t)=>{"use strict";t.d(r,{HomeClient:()=>b});var s=t(5155),n=t(5475),a=t(6462),l=t(536);let o=null;function i(){let e,r,t,s=(r="blog-formelog-news",t="us-east-2:8cd69882-12db-4eb9-a601-5d9fa122d4f3",(e="us-east-2",r&&t)?{region:e,tableName:r,partitionKey:"NEWS",identityPoolId:t}:null);if(!s)return null;if(!o){let e=new n.M({region:s.region,credentials:(0,a.s)({clientConfig:{region:s.region},identityPoolId:s.identityPoolId})});o=l.TG.from(e)}return{client:o,config:s}}async function d(e=20){let r=i();if(!r)return[];let{client:t,config:s}=r;return((await t.send(new l.sf({TableName:s.tableName,KeyConditionExpression:"#pk = :pk",ExpressionAttributeNames:{"#pk":"pk"},ExpressionAttributeValues:{":pk":s.partitionKey},ScanIndexForward:!1,Limit:e}))).Items??[]).map((e,r)=>({id:e.publishedAt||`news-${r+1}`,title:e.title||"Untitled News",source:e.source||"Unknown",publishedAt:e.publishedAt||"Unknown date",link:e.link||""}))}async function c(e,r){let t,s,n,a,o,d,c,m,u=i();if(!u)throw Error("Missing public DynamoDB/Cognito configuration.");let{client:g,config:b}=u,x=(s=String((t=new Date).getFullYear()),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),d=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),m=String(t.getMilliseconds()).padStart(3,"0"),`${s}${n}${a}${o}${d}${c}${m}`);return await g.send(new l.Z$({TableName:b.tableName,Item:{pk:b.partitionKey,publishedAt:x,title:e,link:r,source:"Yunho"},ConditionExpression:"attribute_not_exists(pk) AND attribute_not_exists(publishedAt)"})),x}var m=t(5772),u=t(2115);let g=[{id:"p-1",title:"Weight.ForMeLog | Simple Daily Weight Tracker",summary:"Track your daily weight, visualize progress with a clean chart, and manage records directly in your browser.",link:"https://weight.formelog.com"},{id:"p-2",title:"IELTS.ForMeLog | Personal IELTS Learning Service",summary:"Easily save your vocab, remember it better, and use it naturally across all IELTS skills.",link:"https://ielts.formelog.com"},{id:"p-3",title:"ForMeTube | Personal YouTube Archive & Learning System",summary:"Save insightful YouTube videos, organize key takeaways, and build your own searchable knowledge base from video content.",link:"https://youtube.formelog.com"}];function b(){let e="transition-transform duration-100 active:translate-y-px active:scale-[0.99] active:ring-2 active:ring-[#7D665D]",r="transition-transform duration-100 active:translate-y-px active:scale-[0.995] active:brightness-95 active:ring-2 active:ring-[#7D665D]",[t]=(0,u.useState)(g),[n,a]=(0,u.useState)([]),[l,o]=(0,u.useState)("loading"),[i,b]=(0,u.useState)(1),[x,p]=(0,u.useState)("main"),h=(0,u.useRef)(0),f=(0,u.useRef)(null),[w,N]=(0,u.useState)(""),[v,y]=(0,u.useState)(""),[j,k]=(0,u.useState)(""),[S,E]=(0,u.useState)(""),[I,C]=(0,u.useState)("idle"),[_,T]=(0,u.useState)(""),L=(0,u.useCallback)(async()=>{o("loading");try{let e=await d(20);a(e),o("ready")}catch{a([]),o("error")}},[]);async function P(){if(!j.trim()||!S.trim()){T("Please enter both a news title and a news link."),C("idle");return}C("saving"),T("");let e=!1;try{await c(j.trim(),S.trim()),e=!0}catch{T("Save failed. Check DynamoDB/Cognito settings and try again.")}finally{C("idle")}e&&(k(""),E(""),p("main"),L())}if((0,u.useEffect)(()=>{let e=!1,r=()=>{e||L()},t=window.setTimeout(r,0),s=window,n=s.requestIdleCallback?s.requestIdleCallback(()=>{window.clearTimeout(t),r()},{timeout:1200}):void 0;return()=>{e=!0,window.clearTimeout(t),void 0!==n&&s.cancelIdleCallback&&s.cancelIdleCallback(n)}},[L]),(0,u.useEffect)(()=>{if(!("serviceWorker"in navigator))return;let e=!1,r=null,t=e=>{e.waiting&&e.waiting.postMessage({type:"SKIP_WAITING"})},s=()=>{e||(e=!0,window.location.reload())};return navigator.serviceWorker.addEventListener("controllerchange",s),navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(e=>{t(e),e.addEventListener("updatefound",()=>{let r=e.installing;r&&r.addEventListener("statechange",()=>{"installed"===r.state&&navigator.serviceWorker.controller&&t(e)})}),r=window.setInterval(()=>{e.update()},6e4)}).catch(()=>{}),()=>{navigator.serviceWorker.removeEventListener("controllerchange",s),null!==r&&window.clearInterval(r)}},[]),(0,u.useEffect)(()=>{b(1)},[n]),(0,u.useEffect)(()=>{function e(e){let r=f.current;!r||"main"!==x||r.contains(e.target)||(h.current=0)}return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[x]),"hidden1"===x)return(0,s.jsx)("div",{className:"min-h-screen bg-background text-foreground",children:(0,s.jsx)("main",{className:"mx-auto flex w-full max-w-md flex-col gap-4 p-4 sm:p-6 lg:p-8",children:(0,s.jsxs)("article",{className:"rounded-2xl border border-border bg-surface p-6 shadow-sm",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold",children:"Hidden Page 1"}),(0,s.jsx)("p",{className:"mt-2 text-sm text-muted",children:"Enter access credentials to continue."}),(0,s.jsxs)("div",{className:"mt-5 space-y-3",children:[(0,s.jsx)("input",{value:w,onChange:e=>N(e.target.value),className:"w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm outline-none",placeholder:"User key"}),(0,s.jsx)("input",{type:"password",value:v,onChange:e=>y(e.target.value),className:"w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm outline-none",placeholder:"Access key"}),(0,s.jsx)("button",{type:"button",onClick:function(){if("admin"===w.trim()&&"admin"===v.trim()){T(""),p("hidden2"),N(""),y("");return}p("main"),N(""),y(""),h.current=0},className:`w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm font-medium ${e}`,children:"Confirm"})]})]})})});if("hidden2"===x)return(0,s.jsx)("div",{className:"min-h-screen bg-background text-foreground",children:(0,s.jsxs)("main",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 sm:p-6 lg:p-8",children:[(0,s.jsxs)("article",{className:"rounded-2xl border border-border bg-surface p-6 shadow-sm",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold",children:"Hidden Page 2"}),(0,s.jsx)("p",{className:"mt-2 text-sm text-muted",children:"Create a news record for DynamoDB."}),(0,s.jsxs)("div",{className:"mt-3 rounded-lg border border-border bg-surface-strong px-3 py-2 text-xs leading-5 text-muted",children:["Required public config: ",(0,s.jsx)("code",{children:"NEXT_PUBLIC_AWS_REGION"}),", ",(0,s.jsx)("code",{children:"NEXT_PUBLIC_DYNAMODB_NEWS_TABLE"}),",",(0,s.jsx)("code",{children:" NEXT_PUBLIC_DYNAMODB_NEWS_PARTITION_KEY"}),", ",(0,s.jsx)("code",{children:"NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID"}),". Use least-privilege IAM permissions for put/query on ",(0,s.jsx)("code",{children:"blog-formelog-news"})," only."]}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-1 gap-3",children:[(0,s.jsx)("input",{value:j,onChange:e=>k(e.target.value),className:"w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm outline-none",placeholder:"News title"}),(0,s.jsx)("input",{value:S,onChange:e=>E(e.target.value),className:"w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm outline-none",placeholder:"News link"}),(0,s.jsx)("button",{type:"button",onClick:P,disabled:"saving"===I,className:`w-full rounded-lg border border-border bg-surface-strong px-3 py-2 text-sm font-medium disabled:opacity-60 ${e}`,children:"saving"===I?"Saving...":"Save"})]}),_?(0,s.jsx)("p",{className:"mt-3 text-xs text-red-300",children:_}):null]}),(0,s.jsx)("button",{type:"button",onClick:()=>{p("main"),C("idle"),T("")},className:`self-start rounded-lg border border-border bg-surface px-4 py-2 text-sm text-muted ${e}`,children:"Back to Main Page"})]})});let D=Math.max(1,Math.ceil(n.length/5)),$=Math.min(i,D),A=($-1)*5,M=n.slice(A,A+5),B="clamp(1.35rem, 3.4vw, 1.875rem)",W=`calc(${B} * 0.85)`,O=`calc(${B} * 0.7)`;return(0,s.jsx)("div",{className:"min-h-screen bg-background text-foreground",children:(0,s.jsxs)("main",{className:"mx-auto w-full max-w-7xl px-3 pb-4 sm:px-5 sm:pb-6 lg:px-8 lg:pb-8",children:[(0,s.jsx)("div",{className:"sticky top-0 z-30 mb-4 border-b border-border/80 bg-background/95 pt-3 pb-2 backdrop-blur-sm sm:mb-6 sm:pt-4 sm:pb-3",children:(0,s.jsxs)("div",{className:"flex flex-nowrap items-center gap-2 sm:gap-3",children:[(0,s.jsxs)("div",{className:"relative -top-[2px] inline-flex shrink items-end gap-1 rounded-xl border border-border px-2 py-[6px] sm:px-3 sm:pt-1 sm:pb-[8px]",style:{backgroundColor:"rgb(217, 217, 217)"},"aria-label":"for me Log word mark",children:[(0,s.jsx)("span",{className:"font-extrabold leading-none whitespace-nowrap",style:{fontFamily:"Pretendard, sans-serif",color:"rgb(90, 90, 90)",fontSize:O},children:"for"}),(0,s.jsx)("span",{className:"font-extrabold leading-none whitespace-nowrap",style:{fontFamily:"Pretendard, sans-serif",color:"rgb(90, 90, 90)",fontSize:W},children:"me"}),(0,s.jsx)("span",{className:"font-extrabold leading-none whitespace-nowrap",style:{fontFamily:"Pretendard, sans-serif",color:"rgb(90, 90, 90)",fontSize:B},children:"Log"})]}),(0,s.jsx)("h1",{className:"min-w-0 shrink text-nowrap font-bold text-foreground",style:{fontSize:B},children:"Blog.ForMeLog"})]})}),(0,s.jsxs)("section",{className:"grid grid-cols-1 gap-3 sm:gap-4 md:grid-cols-2 lg:grid-cols-3",children:[(0,s.jsxs)("article",{className:"rounded-2xl border border-border bg-surface p-4 shadow-sm sm:p-5",children:[(0,s.jsx)("h2",{className:"mb-4 text-sm font-semibold tracking-[0.06em] text-foreground",children:"Profile"}),(0,s.jsx)("div",{className:"mx-auto w-full max-w-[220px]",children:(0,s.jsx)("div",{className:"rounded-3xl border border-border bg-surface-strong p-2",children:(0,s.jsx)("div",{className:"relative aspect-square w-full overflow-hidden rounded-[22px] border border-border bg-surface-strong",children:(0,s.jsx)(m.default,{src:"/images/myphoto.webp",alt:"Yunho profile photo",fill:!0,sizes:"220px",className:"object-cover",priority:!0})})})}),(0,s.jsxs)("div",{className:"mt-4 space-y-2.5 text-sm leading-6 text-foreground sm:leading-7",children:[(0,s.jsx)("p",{children:"Hello, I’m Yunho, born in South Korea."}),(0,s.jsx)("p",{children:"I enjoy quiet reflection, and I hope to learn diverse knowledge and experiences in the wider world."}),(0,s.jsx)("p",{children:"I sincerely appreciate everyone who shared their knowledge and experiences."}),(0,s.jsx)("p",{className:"pt-1 text-right text-xs text-muted",children:(0,s.jsx)("a",{href:"mailto:formelog00@gmail.com",target:"_blank",rel:"noopener noreferrer",className:`inline-block rounded-sm px-1 ${e}`,children:"formelog00@gmail.com"})})]})]}),(0,s.jsxs)("article",{className:"rounded-xl border border-border bg-surface p-4 shadow-sm sm:p-5",children:[(0,s.jsx)("h2",{className:"mb-4 text-sm font-semibold tracking-[0.06em] text-foreground",children:"Projects"}),(0,s.jsx)("ul",{className:"space-y-3",children:t.map(e=>(0,s.jsx)("li",{children:e.link?(0,s.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:`block rounded-lg border border-border bg-surface-strong p-3 ${r}`,children:[(0,s.jsx)("p",{className:"text-sm font-semibold",children:e.title}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted",children:e.summary})]}):(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-surface-strong p-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold",children:e.title}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted",children:e.summary})]})},e.id))})]}),(0,s.jsxs)("article",{className:"rounded-xl border border-border bg-surface p-4 shadow-sm sm:p-5",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)("button",{ref:f,type:"button",onClick:function(){if("main"!==x)return;let e=h.current+1;h.current=e,e>=10&&(p("hidden1"),h.current=0)},className:`rounded-sm px-1 text-sm font-semibold tracking-[0.06em] text-foreground ${e}`,children:"News"})}),"loading"===l?(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)("p",{className:"text-xs text-muted",children:"Loading latest news..."})}):(0,s.jsx)("ul",{className:"space-y-3",children:M.map(e=>(0,s.jsx)("li",{children:e.link?(0,s.jsx)("a",{href:e.link,className:`block rounded-lg border border-border bg-surface-strong p-3 text-sm font-semibold text-foreground no-underline ${r}`,target:"_blank",rel:"noreferrer",children:e.title}):(0,s.jsx)("div",{className:"rounded-lg border border-border bg-surface-strong p-3",children:(0,s.jsx)("p",{className:"text-sm font-semibold",children:e.title})})},e.id))}),"ready"===l&&D>1?(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:Array.from({length:D},(r,t)=>{let n=t+1;return(0,s.jsx)("button",{type:"button",onClick:()=>b(n),className:`rounded-md border px-2.5 py-1 text-xs ${n===$?"border-border bg-surface-strong text-foreground":"border-border bg-surface text-muted"} ${e}`,children:n},n)})}):null]})]})]})})}}},e=>{e.O(0,[332,441,794,358],()=>e(e.s=4787)),_N_E=e.O()}]);