"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630,6839],{46839:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var n=r(74630),o=r(99546),s=r(98231),i=r(65468),a=r(37962),c=r(89870),l=r(68446),u=r(37205),d=r(69500);const h=(0,l.observer)((function({model:e}){return(0,d.jsx)(u.A,{message:`${e.error}`,severity:"error",action:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.A,{title:"Reload track",children:(0,d.jsx)(c.A,{"data-testid":"reload_button",onClick:()=>{e.reload()},children:(0,d.jsx)(s.A,{})})}),(0,d.jsx)(a.A,{title:"Show stack trace",children:(0,d.jsx)(c.A,{onClick:()=>{(0,o.getSession)(e).queueDialog((t=>[n.default,{onClose:t,error:e.error}]))},children:(0,d.jsx)(i.A,{})})})]})})}))},74630:(e,t,r)=>{r.r(t),r.d(t,{default:()=>y});var n=r(7552),o=r(62266),s=r(61282),i=r(76218),a=r(30698),c=r(69092),l=r(31409),u=r.n(l),d=r(1631),h=r(75785),w=r(92562),p=r(58531),x=r(37565),f=r(69500);async function j(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} fetching ${e}: ${await t.text()}`);return t}const b={};async function g(e){if(void 0!==b[e])return b[e];const t=new URL(e).search,r=await async function(e){return(await j(e)).text()}(e);let n=new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(r)?.[1]||"";n=new URL(n,e).href+t;const o=await async function(e){return(await j(e)).json()}(n),s=new d.SourceMapConsumer(o);return b[e]=s,s}const m=1e4,k=(0,h.n9)()((e=>({pre:{background:(0,o.X4)(e.palette.error.main,.2),border:`1px solid ${e.palette.divider}`,overflow:"auto",margin:20,maxHeight:300}})));function $({text:e,extra:t}){const{classes:r}=k(),n=encodeURIComponent(`${["I got this error from JBrowse, here is the stack trace:\n","```",e,"```",t?`supporting data: ${JSON.stringify(t,null,2)}`:""].join("\n")}\n`),o=[e,t?`supporting data: ${JSON.stringify(t,null,2)}`:""].join("\n"),i="jbrowse2@berkeley.edu",a=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${n}`,c=`mailto:${i}?subject=JBrowse%202%20error&body=${n}`;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(s.A,{children:["Post a new issue at"," ",(0,f.jsx)(p.A,{href:a,children:"GitHub"})," or send an email to ",(0,f.jsx)(p.A,{href:c,children:i})," "]}),(0,f.jsx)("pre",{className:r.pre,children:o})]})}function y({error:e,onClose:t,extra:r}){const[o,s]=(0,n.useState)(),[l,d]=(0,n.useState)(),[h,p]=(0,n.useState)(!1),j=e?`${e}`:"",b=function(e,t){if(e.startsWith("Error:")){const r=`${t}`;return e.slice(r.length)}return e}(`${"object"==typeof e&&null!==e&&"stack"in e?e.stack:""}`,j);(0,n.useEffect)((()=>{(async()=>{try{const e=await async function(e){const t=e.split("\n"),r=[];for(const e of t){const t=new RegExp(/(.*)(https?:\/\/.*):(\d+):(\d+)/).exec(e);if(null===t){r.push(e);continue}const n=t[2],o=(await g(n)).originalPositionFor({line:Number.parseInt(t[3]),column:Number.parseInt(t[4])});o.source&&o.line&&o.column?r.push(`${o.source}:${o.line}:${o.column+1} (${t[1].trim()})`):r.push(e)}return r.join("\n")}(b);s(e)}catch(e){console.error(e),s(b),d(e)}})()}),[b]);const k=[l?"Error loading source map, showing raw stack trace below:":"",j.length>m?`${j.slice(0,m)}...`:j,o||"No stack trace available",window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].filter((e=>!!e)).join("\n");return(0,f.jsxs)(w.A,{open:!0,onClose:t,title:"Stack trace",maxWidth:"xl",children:[(0,f.jsx)(i.A,{children:void 0===o?(0,f.jsx)(x.A,{variant:"h6"}):(0,f.jsx)($,{text:k,extra:r})}),(0,f.jsxs)(a.A,{children:[(0,f.jsx)(c.A,{variant:"contained",color:"secondary",onClick:()=>{u()(k),p(!0),setTimeout((()=>{p(!1)}),1e3)},children:h?"Copied!":"Copy stack trace to clipboard"}),(0,f.jsx)(c.A,{variant:"contained",color:"primary",onClick:t,children:"Close"})]})]})}}}]);
//# sourceMappingURL=6839.99bb2477.chunk.js.map