Mercurial > repos > fubar > jbrowse2
view x/static/js/419.021427b6.chunk.js.map @ 125:49f3d3878413 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author | fubar |
---|---|
date | Sat, 05 Oct 2024 23:58:05 +0000 |
parents | |
children |
line wrap: on
line source
{"version":3,"file":"static/js/419.021427b6.chunk.js","mappings":"+UAwBA,MAAMA,GAAYC,EAAAA,EAAAA,KAAAA,EAAa,KAAM,CACnCC,SAAU,CACRC,OAAQ,GAEVC,QAAS,CACPC,QAAS,OACTC,SAAU,SACVC,IAAK,WAqHT,GAjH6BC,EAAAA,EAAAA,WAAS,UAAU,QAC9CC,EAAO,MACPC,IAKA,MAAM,QAAEC,GAAYX,KACbY,EAAKC,IAAUC,EAAAA,EAAAA,UAAS,KACxBC,EAAOC,IAAYF,EAAAA,EAAAA,aACnBG,EAASC,IAAcJ,EAAAA,EAAAA,WAAS,GACjCK,GAAUC,EAAAA,EAAAA,YAAWV,IACrB,kBAAEW,GAAsBX,EACxBY,EAAwC,IAA7BD,EAAkBE,OAC7BC,EACyB,IAA7BH,EAAkBE,OACdb,EAAMe,kBACNf,EAAMgB,qBA8BZ,OA5BAC,EAAAA,EAAAA,YAAU,KAEP,WACC,IACE,KAAKC,EAAAA,EAAAA,uBAAsBT,GACzB,MAAM,IAAIU,MAAM,0BAElBX,GAAW,GACX,MAAMY,GAAOC,EAAAA,EAAAA,aAAYP,GACnBQ,EAAc,IAAIC,IAAIC,OAAOC,SAASC,MACtCC,QAAeC,EAAAA,EAAAA,GACnBR,EACAX,EAAQoB,SACRP,EAAYI,MAERI,EAAS,IAAIC,gBAAgBT,EAAYU,QAC/CF,EAAOG,IAAI,YAAa,SAASN,EAAOO,KAAKC,aAC7CL,EAAOG,IAAI,WAAYN,EAAOS,UAC9Bd,EAAYU,OAASF,EAAOO,WAC5BlC,EAAOmB,EAAYI,MACnBlB,GAAW,EACb,CAAE,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EAG7B,SAASC,EAAYC,GACnB,IAEE,OADYC,KAAKC,MAAMF,GACZG,OACb,CAAE,MAAO1C,GACP,OAAOuC,CACT,CACF,CAEOT,eAAexC,EACpBnB,EACAP,EACA+E,GAEA,MAAMC,QAAaC,EAAAA,EAAAA,IAAaL,KAAKM,UAAU3E,IACzC2B,EArCCZ,OACJ6D,KACC,IAAI7D,OAAO8D,OAAOC,gBAAgB,IAAIC,WAAW3E,MAC9C4E,KAAIC,GAAKC,OAAOC,aAAaF,KAC7BG,KAAK,KAETC,WAAW,QAAS,IACpBC,MAAM,EA8BoB,GAC7B,MAAMC,QAAyBzB,EAAQW,EAAM9C,GAEvC6D,EAAO,IAAIC,SACjBD,EAAKE,OAAO,UAAWH,GACvBC,EAAKE,OAAO,aAAc,GAAGC,KAAKC,SAClCJ,EAAKE,OAAO,UAAWlB,GAEvB,MAAMqB,QAAiBC,MAAM,GAAGrG,SAAY,CAC1CsG,OAAQ,OACRC,KAAM,OACNC,KAAMT,IAGR,IAAKK,EAASK,GAAI,CAChB,MAAM9B,QAAYyB,EAAS9B,OAC3B,MAAM,IAAIrD,MAAMyD,EAAYC,GAC9B,CAEA,MAAO,CACL3C,WAFiBoE,EAASpE,OAG1B8D,mBACA5D,WAEJ,CAEOgC,eAAewC,EACpBC,EACAC,EACA1E,EACA2E,GAEA,MAAM5E,EAAY2E,EAAkBE,MAAM,UAAU,GAC9C9G,EAAM,GAAG2G,eAAqBI,mBAAmB9E,KACjDmE,QAAiBC,MAAMrG,EAAK,CAChC6G,WAGF,IAAKT,EAASK,GAAI,CAChB,MAAM9B,QAAYyB,EAAS9B,OAC3B,MAAM,IAAIrD,MAAMyD,EAAYC,GAC9B,CAEA,MAAM3C,QAAaoE,EAASpE,OAC5B,OAAOuC,EAAQvC,EAAKzB,QAAS2B,EAC/B,C","sources":["../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/sessionSharing.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { observer } from 'mobx-react'\nimport { getSnapshot } from 'mobx-state-tree'\n\nimport {\n Alert,\n Button,\n DialogActions,\n DialogContent,\n DialogContentText,\n TextField,\n Typography,\n} from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport copy from 'copy-to-clipboard'\n\nimport { getSession, isSessionWithShareURL } from '@jbrowse/core/util'\nimport { Dialog, ErrorMessage } from '@jbrowse/core/ui'\nimport { ContentCopy as ContentCopyIcon } from '@jbrowse/core/ui/Icons'\n\n// locals\nimport { shareSessionToDynamo } from '../../sessionSharing'\nimport { GridBookmarkModel } from '../../model'\n\nconst useStyles = makeStyles()(() => ({\n flexItem: {\n margin: 5,\n },\n content: {\n display: 'flex',\n flexFlow: 'column',\n gap: '5px',\n },\n}))\n\nconst ShareBookmarksDialog = observer(function ({\n onClose,\n model,\n}: {\n onClose: () => void\n model: GridBookmarkModel\n}) {\n const { classes } = useStyles()\n const [url, setUrl] = useState('')\n const [error, setError] = useState<unknown>()\n const [loading, setLoading] = useState(true)\n const session = getSession(model)\n const { selectedBookmarks } = model\n const shareAll = selectedBookmarks.length === 0\n const bookmarksToShare =\n selectedBookmarks.length === 0\n ? model.allBookmarksModel\n : model.sharedBookmarksModel\n\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n if (!isSessionWithShareURL(session)) {\n throw new Error('No shareURL configured')\n }\n setLoading(true)\n const snap = getSnapshot(bookmarksToShare)\n const locationUrl = new URL(window.location.href)\n const result = await shareSessionToDynamo(\n snap,\n session.shareURL,\n locationUrl.href,\n )\n const params = new URLSearchParams(locationUrl.search)\n params.set('bookmarks', `share-${result.json.sessionId}`)\n params.set('password', result.password)\n locationUrl.search = params.toString()\n setUrl(locationUrl.href)\n setLoading(false)\n } catch (e) {\n setError(e)\n } finally {\n setLoading(false)\n }\n })()\n }, [bookmarksToShare, session])\n return (\n <Dialog open onClose={onClose} title=\"Share bookmarks\">\n <DialogContent className={classes.content}>\n <Alert severity=\"info\">\n {shareAll ? (\n <>\n <span>All bookmarks will be shared.</span>\n <br />\n <span>\n Use the checkboxes to select individual bookmarks to share.\n </span>\n </>\n ) : (\n 'Only selected bookmarks will be shared.'\n )}\n </Alert>\n <DialogContentText>\n Copy the URL below to share your bookmarks.\n </DialogContentText>\n {error ? (\n <ErrorMessage error={error} />\n ) : loading ? (\n <Typography>Generating short URL...</Typography>\n ) : (\n <TextField\n label=\"URL\"\n value={url}\n slotProps={{\n input: {\n readOnly: true,\n },\n }}\n variant=\"filled\"\n fullWidth\n onClick={event => {\n const target = event.target as HTMLTextAreaElement\n target.select()\n }}\n />\n )}\n <DialogContentText>\n The URL should be pasted into the \"Import from share link\" field in\n the \"Import\" form found in the \"Bookmarked regions\" drawer.\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n className={classes.flexItem}\n data-testid=\"dialogShare\"\n variant=\"contained\"\n color=\"primary\"\n disabled={loading}\n startIcon={<ContentCopyIcon />}\n onClick={async () => {\n copy(url)\n session.notify('Copied to clipboard', 'success')\n onClose()\n }}\n >\n Copy share link\n </Button>\n </DialogActions>\n </Dialog>\n )\n})\n\nexport default ShareBookmarksDialog\n","// duplicated from products/jbrowse-web/src/sessionSharing.ts ; could possibly be moved into a higher directory and shared between the two\nimport { toUrlSafeB64 } from './utils'\n\n// from https://stackoverflow.com/questions/1349404/\nfunction generateUID(length: number) {\n return window\n .btoa(\n [...window.crypto.getRandomValues(new Uint8Array(length * 2))]\n .map(b => String.fromCharCode(b))\n .join(''),\n )\n .replaceAll(/[+/]/g, '')\n .slice(0, length)\n}\n\nconst encrypt = async (text: string, password: string) => {\n const AES = await import('crypto-js/aes')\n return AES.encrypt(text, password).toString()\n}\n\nconst decrypt = async (text: string, password: string) => {\n const AES = await import('crypto-js/aes')\n const Utf8 = await import('crypto-js/enc-utf8')\n const bytes = AES.decrypt(text, password)\n return bytes.toString(Utf8)\n}\n\nfunction getErrorMsg(err: string) {\n try {\n const obj = JSON.parse(err)\n return obj.message\n } catch (e) {\n return err\n }\n}\n// writes the encrypted session, current datetime, and referer to DynamoDB\nexport async function shareSessionToDynamo(\n session: unknown,\n url: string,\n referer: string,\n) {\n const sess = await toUrlSafeB64(JSON.stringify(session))\n const password = generateUID(5)\n const encryptedSession = await encrypt(sess, password)\n\n const data = new FormData()\n data.append('session', encryptedSession)\n data.append('dateShared', `${Date.now()}`)\n data.append('referer', referer)\n\n const response = await fetch(`${url}share`, {\n method: 'POST',\n mode: 'cors',\n body: data,\n })\n\n if (!response.ok) {\n const err = await response.text()\n throw new Error(getErrorMsg(err))\n }\n const json = await response.json()\n return {\n json,\n encryptedSession,\n password,\n }\n}\n\nexport async function readSessionFromDynamo(\n baseUrl: string,\n sessionQueryParam: string,\n password: string,\n signal?: AbortSignal,\n) {\n const sessionId = sessionQueryParam.split('share-')[1]!\n const url = `${baseUrl}?sessionId=${encodeURIComponent(sessionId)}`\n const response = await fetch(url, {\n signal,\n })\n\n if (!response.ok) {\n const err = await response.text()\n throw new Error(getErrorMsg(err))\n }\n\n const json = await response.json()\n return decrypt(json.session, password)\n}\n"],"names":["useStyles","makeStyles","flexItem","margin","content","display","flexFlow","gap","observer","onClose","model","classes","url","setUrl","useState","error","setError","loading","setLoading","session","getSession","selectedBookmarks","shareAll","length","bookmarksToShare","allBookmarksModel","sharedBookmarksModel","useEffect","isSessionWithShareURL","Error","snap","getSnapshot","locationUrl","URL","window","location","href","result","shareSessionToDynamo","shareURL","params","URLSearchParams","search","set","json","sessionId","password","toString","e","React","Dialog","open","title","DialogContent","className","Alert","severity","DialogContentText","ErrorMessage","Typography","TextField","label","value","slotProps","input","readOnly","variant","fullWidth","onClick","event","target","select","DialogActions","Button","color","disabled","startIcon","ContentCopyIcon","async","copy","notify","encrypt","text","decrypt","AES","Utf8","getErrorMsg","err","JSON","parse","message","referer","sess","toUrlSafeB64","stringify","btoa","crypto","getRandomValues","Uint8Array","map","b","String","fromCharCode","join","replaceAll","slice","encryptedSession","data","FormData","append","Date","now","response","fetch","method","mode","body","ok","readSessionFromDynamo","baseUrl","sessionQueryParam","signal","split","encodeURIComponent"],"sourceRoot":""}