import{r as s,j as e}from"./sikshya-admin-sikshya-react-E_TY_un4.js";import{l as m,b as p}from"./sikshya-admin.js";import{ad as t}from"./sikshya-admin-sikshya-vendor-BVAk_Gwu.js";function b({error:r,onRetry:d,title:l=t("Something went wrong","sikshya")}){const a=s.useMemo(()=>m(r),[r]),i=s.useMemo(()=>p(r),[r]),[n,o]=s.useState(!1),x=s.useCallback(async()=>{try{await navigator.clipboard.writeText(a.fullText),o(!0),window.setTimeout(()=>o(!1),2e3)}catch{o(!1)}},[a.fullText]);return e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/90 p-4 text-red-950 shadow-sm",role:"alert",children:[e.jsx("h3",{className:"text-sm font-semibold text-red-900",children:l}),e.jsx("p",{className:"mt-1 text-sm text-red-800",children:i}),e.jsx("p",{className:"mt-2 text-xs text-red-700/90",children:t("Copy the report below and send it to Sikshya support so we can reproduce the issue.","sikshya")}),e.jsx("div",{className:"mt-3 max-h-48 overflow-auto rounded-lg border border-red-200/80 bg-white p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-slate-800",children:a.fullText})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:x,className:"rounded-lg bg-red-800 px-3 py-1.5 text-xs font-medium text-white hover:bg-red-900",children:n?t("Copied!","sikshya"):t("Copy error report","sikshya")}),d?e.jsx("button",{type:"button",onClick:d,className:"rounded-lg border border-red-300 bg-white px-3 py-1.5 text-xs font-medium text-red-900 hover:bg-red-50",children:t("Try again","sikshya")}):null]})]})}export{b as A};
