1var U=Object.defineProperty;var a=(r,o)=>U(r,"name",{value:o,configurable:!0});import{r as l,b as h,j as e,q as B,A as T,h as z,i as M,C as E}from"./index-CUP8bgIJ.js";const H=a(r=>{try{const o=r.split(".");if(o.length!==3)return null;const i=o[1].replace(/-/g,"+").replace(/_/g,"/"),d=i.length%4,p=d?i+"=".repeat(4-d):i,g=decodeURIComponent(window.atob(p).split("").map(m=>"%"+("00"+m.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(g)}catch{return null}},"decodeJWT"),J=a(()=>{const r=localStorage.getItem("token");if(!r)return null;const o=H(r);return o?.actorId||o?.actor_id},"getActorIdFromToken"),u=a(()=>window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"http://localhost:3000":"https://registration-app-production.up.railway.app","getApiUrl"),W=a(({spendingId:r,onClose:o,onReactionAdded:n,spending:i})=>{const[d,p]=l.useState([]),[g,m]=l.useState(!0),[O,f]=l.useState(null),[b,y]=l.useState(""),[c,_]=l.useState(""),[j,C]=l.useState(!1),[P,N]=l.useState({isOpen:!1}),k=J();l.useEffect(()=>{x()},[r]);const x=a(async()=>{try{m(!0);const t=localStorage.getItem("token"),s=await h.get(`${u()}/api/spendings/${r}/comments`,{headers:{Authorization:`Bearer ${t}`}});p(s.data.comments||[])}catch(t){console.error("Failed to fetch reactions:",t)}finally{m(!1)}},"fetchReactions"),R=a(async t=>{if(b.trim())try{const s=localStorage.getItem("token");await h.post(`${u()}/api/spendings/${r}/comments`,{content:b,parent_comment_id:t},{headers:{Authorization:`Bearer ${s}`}}),y(""),f(null),x(),n&&n()}catch(s){console.error("Failed to post reply:",s)}},"handleReply"),F=a(async()=>{if(c.trim())try{C(!0);const t=localStorage.getItem("token");await h.post(`${u()}/api/spendings/${r}/comments`,{content:c},{headers:{Authorization:`Bearer ${t}`}}),_(""),x(),n&&n()}catch(t){console.error("Failed to post comment:",t)}finally{C(!1)}},"handlePostNewComment"),S=a(async t=>{N({isOpen:!0,title:"ã³ã¡ã³ãã®åé¤",message:"ãã®ã³ã¡ã³ããåé¤ãã¾ããï¼",type:"danger",onConfirm:a(async()=>{N({isOpen:!1});try{const s=localStorage.getItem("token");await h.delete(`${u()}/api/spendings/${r}/comments/${t}`,{headers:{Authorization:`Bearer ${s}`}}),x(),n&&n()}catch(s){console.error("Failed to delete comment:",s)}},"onConfirm"),onCancel:a(()=>N({isOpen:!1}),"onCancel")})},"handleDeleteReaction"),A=a(t=>{const s=new Date,I=new Date(t),v=s-I,w=Math.floor(v/6e4),L=Math.floor(v/36e5),D=Math.floor(v/864e5);return w<1?"ãã£ãä»":w<60?`${w}åå`:L<24?`${L}æéå`:D<7?`${D}æ¥å`:I.toLocaleDateString("ja-JP")},"formatTimeAgo"),$=d;return e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:[e.jsxs("div",{className:"bg-white rounded-lg max-w-3xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"ð¬ ã³ã¡ã³ã"}),e.jsx("button",{onClick:o,className:"text-gray-600 hover:text-gray-900 p-2 rounded-lg hover:bg-gray-100",children:e.jsx(B,{className:"text-xl"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 pb-32",children:g?e.jsx("div",{className:"text-center py-12 text-gray-600",children:"èªã¿è¾¼ã¿ä¸..."}):e.jsx("div",{className:"space-y-4",children:$.length===0?e.jsx("p",{className:"text-gray-600 text-center py-8",children:"ã¾ã ã³ã¡ã³ããããã¾ãã"}):$.map(t=>e.jsx("div",{className:"border border-gray-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(T,{actorId:t.author?.actor_id,displayName:t.author?.display_name,profileImageUrl:t.author?.profile_image_url,actorType:t.author?.actor_type||"user",actorStatus:z(t.author?.last_active_at),size:"md",showName:!1})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-gray-900",children:t.author?.display_name||"å¿å"}),e.jsxs("span",{className:"text-sm text-gray-600",children:["· ",A(t.created_at)]})]}),e.jsx("p",{className:"text-gray-800 whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs("button",{onClick:a(()=>f(t.comment_id),"onClick"),className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:[e.jsx(M,{})," è¿ä¿¡"]}),t.author?.actor_id===k&&e.jsx("button",{onClick:a(()=>S(t.comment_id),"onClick"),className:"text-sm text-red-600 hover:text-red-800",children:"åé¤"})]}),O===t.comment_id&&e.jsxs("div",{className:"mt-3 bg-gray-50 p-3 rounded-lg",children:[e.jsx("textarea",{value:b,onChange:a(s=>y(s.target.value),"onChange"),placeholder:"è¿ä¿¡ãå ¥å...",className:"w-full border border-gray-300 rounded-lg p-2 mb-2 resize-none",rows:"3"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:a(()=>{f(null),y("")},"onClick"),className:"px-3 py-1 text-sm bg-gray-200 text-gray-800 rounded-lg hover:bg-gray-300",children:"ãã£ã³ã»ã«"}),e.jsx("button",{onClick:a(()=>R(t.comment_id),"onClick"),className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:"è¿ä¿¡ãã"})]})]}),t.replies&&t.replies.length>0&&e.jsx("div",{className:"ml-6 mt-3 space-y-3 border-l-2 border-gray-200 pl-4",children:t.replies.map(s=>e.jsx("div",{className:"bg-gray-50 p-3 rounded-lg",children:e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(T,{actorId:s.author?.actor_id,displayName:s.author?.display_name,profileImageUrl:s.author?.profile_image_url,actorType:s.author?.actor_type||"user",actorStatus:z(s.author?.last_active_at),size:"sm",showName:!1})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:s.author?.display_name||"å¿å"}),e.jsxs("span",{className:"text-xs text-gray-600",children:["· ",A(s.created_at)]})]}),e.jsx("p",{className:"text-sm text-gray-800 whitespace-pre-wrap break-words",children:s.content}),s.author?.actor_id===k&&e.jsx("button",{onClick:a(()=>S(s.comment_id),"onClick"),className:"text-xs text-red-600 hover:text-red-800 mt-1",children:"åé¤"})]})]})},s.comment_id))})]})]})},t.comment_id))})}),e.jsxs("div",{className:"border-t border-gray-200 bg-white p-4",children:[i&&e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:["è¿ä¿¡å :"," ",e.jsxs("span",{className:"text-blue-600 font-medium",children:["@",i.actor?.display_name||"å¿å"]})]}),e.jsxs("div",{children:[e.jsx("textarea",{value:c,onChange:a(t=>_(t.target.value),"onChange"),placeholder:"è¿ä¿¡ããã¹ã",className:"w-full border border-gray-300 rounded-lg p-3 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",rows:"3",disabled:j}),e.jsxs("div",{className:"flex justify-between items-center mt-2",children:[e.jsx("div",{className:"text-sm text-gray-500",children:c.length>0&&`${c.length} æå`}),e.jsx("button",{onClick:F,disabled:!c.trim()||j,className:"px-6 py-2 bg-blue-600 text-white rounded-full font-bold hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",children:j?"æç¨¿ä¸...":"è¿ä¿¡"})]})]})]})]}),e.jsx(E,{...P})]})},"SpendingReactionDetail");var G=W;export{G as S}; 2//# sourceMappingURL=SpendingReactionDetail-snV9z4HQ.js.map
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.