"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630],{74630:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var o=n(7552),r=n(36715),a=n(87731),s=n(29499),c=n(58507),l=n(5401),i=n(1631),u=n(31409),w=n.n(u),m=n(92562),h=n(37565);const b={};async function p(e){if(null!=b[e])return b[e];const t=new URL(e).search,n=await(await fetch(e)).text();let o=new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(n)?.[1]||"";o=new URL(o,e).href+t;const r=await(await fetch(o)).json();return b[e]=r,r}const d=1e4;function g({text:e}){const t=encodeURIComponent("I got this error from JBrowse, here is the stack trace:\n\n```\n"+e+"\n```\n"),n=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${t}`,s=`mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${t}`;return o.createElement(o.Fragment,null,o.createElement(r.A,null,"Post a new issue at"," ",o.createElement(a.A,{href:n,target:"_blank"},"GitHub")," ","or send an email to"," ",o.createElement(a.A,{href:s,target:"_blank"},"jbrowse2dev@gmail.com")," "),o.createElement("pre",{style:{background:"lightgrey",border:"1px solid black",overflow:"auto",margin:20,maxHeight:300}},e))}function f({error:e,onClose:t}){const[n,r]=(0,o.useState)(),[a,u]=(0,o.useState)(),[b,f]=(0,o.useState)(!1),E=`${e}`,k=function(e,t){if(e.startsWith("Error:")){const n=`${t}`;return e.slice(n.length)}return e}(`${e.stack}`,E);(0,o.useEffect)((()=>{(async()=>{try{const e=await async function(e){const t=e.split("\n"),n=[];for(const e of t){const t=new RegExp(/(.*)(http:\/\/.*):(\d+):(\d+)/).exec(e);if(null===t){n.push(e);continue}const o=t[2],r=new i.SourceMapConsumer(await p(o)).originalPositionFor({line:parseInt(t[3]),column:parseInt(t[4])});null!==r.source&&null!==r.line&&null!==r.column?n.push(`${r.source}:${r.line}:${r.column+1}`):n.push(e)}return n.join("\n")}(k);r(e)}catch(e){console.error(e),r(k),u(e)}})()}),[k]);const x=[a?"Error loading source map, showing raw stack trace below:":"",E.length>d?E.slice(0,d)+"...":E,n||"No stack trace available",window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].join("\n");return o.createElement(m.A,{open:!0,onClose:t,title:"Stack trace",maxWidth:"xl"},o.createElement(s.A,null,void 0===n?o.createElement(h.A,{variant:"h6"}):o.createElement(g,{text:x})),o.createElement(c.A,null,o.createElement(l.A,{variant:"contained",color:"secondary",onClick:()=>{w()(x),f(!0),setTimeout((()=>f(!1)),1e3)}},b?"Copied!":"Copy stack trace to clipboard"),o.createElement(l.A,{variant:"contained",color:"primary",onClick:t},"Close")))}}}]);
//# sourceMappingURL=4630.38f9421c.chunk.js.map