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