"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[7086],{67086:function(e,s,r){r.r(s);var n=r(32723),t=r(34795),o=r(96234),a=r(96902),c=r(63680),i=r(4782),u=r(17867),l=r(66519),h=r(52809),d=r(92735),f=r(25322),p=r(35388),x=r(99688),w=r(44536),Z=r(21051),j=r.n(Z),S=r(52044),b=r(25471),v=r(23642),k=r(68029),C=r(35719),g=r(65828),m=r(29938),L=(0,a.lazy)((function(){return r.e(1173).then(r.bind(r,1173))}));function y(e){var s=e.url;return(0,m.jsx)(l.Z,{label:"URL",value:s,InputProps:{readOnly:!0},variant:"filled",fullWidth:!0,onClick:function(e){e.target.select()}})}s.default=(0,i.observer)((function(e){var s=e.handleClose,r=e.session,i=(0,a.useState)(""),l=(0,o.Z)(i,2),Z=l[0],R=l[1],U=(0,a.useState)(""),P=(0,o.Z)(U,2),I=P[0],V=P[1],B=(0,a.useState)(""),D=(0,o.Z)(B,2),J=D[0],_=D[1],z=(0,a.useState)(""),M=(0,o.Z)(z,2),E=M[0],F=M[1],N=(0,a.useState)(!0),O=(0,o.Z)(N,2),Q=O[0],W=O[1],A=(0,a.useState)(),G=(0,o.Z)(A,2),Y=G[0],q=G[1],H=(0,a.useState)(!1),K=(0,o.Z)(H,2),T=K[0],X=K[1],$=(0,S.useQueryParam)("password",S.StringParam),ee=(0,o.Z)($,2)[1],se=(0,S.useQueryParam)("session",S.StringParam),re=(0,o.Z)(se,2)[1],ne=r.shareURL,te=localStorage.getItem("jbrowse-shareURL")||"short",oe=(0,c.getSnapshot)(r);return(0,a.useEffect)((function(){var e=!1;return(0,t.Z)((0,n.Z)().mark((function s(){var t,o,a,i,u,l;return(0,n.Z)().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,"short"!==te){s.next=10;break}return W(!0),t=new URL(window.location.href),s.next=6,(0,g.p)(oe,ne,t.href);case 6:o=s.sent,e||((a=new URLSearchParams(t.search)).set("session","share-".concat(o.json.sessionId)),a.set("password",o.password),t.search=a.toString(),_(t.href),R("share-".concat(o.json.sessionId)),V(o.password)),s.next=19;break;case 10:return s.next=12,(0,C.JY)(JSON.stringify((0,c.getSnapshot)(r)));case 12:i=s.sent,u=new URL(window.location.href),(l=new URLSearchParams(u.search)).set("session","encoded-".concat(i)),R("encoded-".concat(i)),u.search=l.toString(),e||F(u.toString());case 19:s.next=24;break;case 21:s.prev=21,s.t0=s.catch(0),q(s.t0);case 24:return s.prev=24,W(!1),s.finish(24);case 27:case"end":return s.stop()}}),s,null,[[0,21,24,27]])})))(),function(){e=!0}}),[te,r,ne,oe]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Dialog,{maxWidth:"xl",open:!0,onClose:s,title:"JBrowse Shareable Link",children:[(0,m.jsxs)(h.Z,{children:[(0,m.jsxs)(d.Z,{children:["Copy the URL below to share your current JBrowse session.",(0,m.jsx)(f.Z,{onClick:function(){return X(!0)},children:(0,m.jsx)(b.Z,{})})]}),"short"===te?Y?(0,m.jsx)(u.ErrorMessage,{error:Y}):Q?(0,m.jsx)(p.Z,{children:"Generating short URL..."}):(0,m.jsx)(y,{url:J}):(0,m.jsx)(y,{url:E})]}),(0,m.jsxs)(x.Z,{children:[(0,m.jsx)(w.Z,{startIcon:(0,m.jsx)(k.Z,{}),disabled:"short"===te&&Q,onClick:function(e){e.preventDefault(),ee(I),re(Z),alert("Now press Ctrl+D (PC) or Cmd+D (Mac)")},children:"Bookmark"}),(0,m.jsx)(w.Z,{onClick:function(){j()(J||E),r.notify("Copied to clipboard","success")},startIcon:(0,m.jsx)(v.pt,{}),disabled:"short"===te&&Q,children:"Copy to Clipboard"}),(0,m.jsx)(w.Z,{onClick:s,autoFocus:!0,children:"Close"})]})]}),(0,m.jsx)(L,{open:T,onClose:function(){return X(!1)},currentSetting:te})]})}))},68029:function(e,s,r){var n=r(71600);s.Z=void 0;var t=n(r(7152)),o=r(29938),a=(0,t.default)((0,o.jsx)("path",{d:"M21 7h-2v2h-2V7h-2V5h2V3h2v2h2v2zm-2 14-7-3-7 3V5c0-1.1.9-2 2-2h7c-.63.84-1 1.87-1 3 0 2.76 2.24 5 5 5 .34 0 .68-.03 1-.1V21z"}),"BookmarkAdd");s.Z=a}}]);
//# sourceMappingURL=7086.5ffd245e.chunk.js.map