(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},48284,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(18566);e.s(["default",0,function({trahId:e,personId:s,displayName:i}){let o=(0,n.useRouter)(),[a,l]=(0,r.useState)(null),[c,u]=(0,r.useState)(!1),[h,d]=(0,r.useState)(!1);async function m(){l(null),u(!0);try{let t=await fetch(`/api/trahs/${e}/persons/${s}/claim`,{method:"POST"});if(t.ok){d(!0),o.refresh(),setTimeout(()=>o.push(`/trahs/${e}`),1e3);return}let r=await t.json().catch(()=>null);r?.error==="ALREADY_CLAIMED"?l("This person has already been claimed by another member."):r?.error==="PERSON_NOT_FOUND"?l("This person could not be found."):l("Something went wrong. Please try again.")}catch{l("Something went wrong. Please try again.")}finally{u(!1)}}return h?(0,t.jsxs)("p",{children:["You have claimed ",i,". Redirecting…"]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:["Are you ",i,"?"]}),a&&(0,t.jsx)("p",{role:"alert",style:{color:"crimson"},children:a}),(0,t.jsx)("button",{type:"button",disabled:c,onClick:m,children:c?"Confirming…":`Yes, I am ${i}`})]})}])}]);