"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630],{74630:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var r=n(7552),o=n(87731),a=n(72639),s=n(36715),c=n(29499),i=n(58507),l=n(5401),u=n(75785),w=n(1631),m=n(31409),p=n.n(m),h=n(92562),f=n(37565);function d({href:e,children:t}){return r.createElement(o.A,{target:"_blank",href:e},t)}async function b(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} fetching ${e}: ${await t.text()}`);return t}const g={};async function E(e){if(void 0!==g[e])return g[e];const t=new URL(e).search,n=await async function(e){return(await b(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 b(e)).json()}(r),a=new w.SourceMapConsumer(o);return g[e]=a,a}const $=1e4,k=(0,u.n9)()((e=>({pre:{background:(0,a.X4)(e.palette.error.main,.2),border:`1px solid ${e.palette.divider}`,overflow:"auto",margin:20,maxHeight:300}})));function y({text:e,extra:t}){const{classes:n}=k(),o=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`),a=[e,t?`supporting data: ${JSON.stringify(t,null,2)}`:""].join("\n"),c="jbrowse2@berkeley.edu",i=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${o}`,l=`mailto:${c}?subject=JBrowse%202%20error&body=${o}`;return r.createElement(r.Fragment,null,r.createElement(s.A,null,"Post a new issue at ",r.createElement(d,{href:i},"GitHub")," or send an email to ",r.createElement(d,{href:l},c)," "),r.createElement("pre",{className:n.pre},a))}function x({error:e,onClose:t,extra:n}){const[o,a]=(0,r.useState)(),[s,u]=(0,r.useState)(),[w,m]=(0,r.useState)(!1),d=e?`${e}`:"",b=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:""}`,d);(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 E(r)).originalPositionFor({line:Number.parseInt(t[3]),column:Number.parseInt(t[4])});o.source&&o.line&&o.column?n.push(`${o.source}:${o.line}:${o.column+1} (${t[1].trim()})`):n.push(e)}return n.join("\n")}(b);a(e)}catch(e){console.error(e),a(b),u(e)}})()}),[b]);const g=[s?"Error loading source map, showing raw stack trace below:":"",d.length>$?`${d.slice(0,$)}...`:d,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(c.A,null,void 0===o?r.createElement(f.A,{variant:"h6"}):r.createElement(y,{text:g,extra:n})),r.createElement(i.A,null,r.createElement(l.A,{variant:"contained",color:"secondary",onClick:()=>{p()(g),m(!0),setTimeout((()=>{m(!1)}),1e3)}},w?"Copied!":"Copy stack trace to clipboard"),r.createElement(l.A,{variant:"contained",color:"primary",onClick:t},"Close")))}}}]);
//# sourceMappingURL=4630.f0bdb9f0.chunk.js.map