"/*\n tabSlideOUt v2.4\n\n Originally by William Paoli: http://code.google.com/p/tab-slide-out\n Maintained by Michael Fielding: https://github.com/hawk-ip/jquery.tabSlideOut.js\n License: GPL v3.0\n\n To use this you need an element for the tab panel content ('panel'), and inside it an element for the\n tab which will stick out from the window edge and be clickable ('handle'). By default the selector\n for handles is '.handle'.\n\n example HTML:\n\n <div id=\"my-tab\"><span class=\"handle\">Click me</span>Hello World</div>\n\n example JavaScript (puts the tab on the right, and opens it on hover rather than click):\n\n $('#my-tab').tabSlideOut( {'tabLocation':'right','action':'hover'} );\n\n Style the tab panel and handle using CSS. Add the class ui-slideouttab-handle-rounded to handles to give them\n rounded outer corners.\n\n You can use some methods to programmatically interact with tabs. Methods except 'isOpen' are chainable.\n\n $('#my-tab').tabSlideOut('isOpen'); // return true or false\n $('#my-tab').tabSlideOut('open'); // opens it\n $('#my-tab').tabSlideOut('close'); // closes it\n $('#my-tab').tabSlideOut('toggle'); // toggles it\n $('#my-tab').tabSlideOut('bounce'); // bounces the tab\n\n You can also send JQuery events to initiate actions:\n\n $('#my-tab').trigger('open'); // opens it\n $('#my-tab').trigger('close'); // closes it\n $('#my-tab').trigger('toggle'); // toggles it\n $('#my-tab').trigger('bounce'); // bounces the tab\n\n Three events are defined and can be caught when tabs open and close:\n\n $(document).on('slideouttabopen slideouttabclose slideouttabbounce',function(event){\n var $panel = $(event.target);\n var eventType = event.type;\n // your code here\n });\n\n Features are demonstrated on the related demo page.\n*/\n(function($) {\n $.fn.tabSlideOut = function(callerSettings) {\n\n /**\n * @param node Element to get the height of.\n * @return string e.g. '123px'\n */\n function heightAsString(node) {\n return parseInt(node.outerHeight() + 1, 10) + 'px';\n }\n\n /*\n * Get the width of the given border, in pixels.\n *\n * @param node element\n * @param string edge\n * @returns int\n */\n function borderWidth(element, edge) {\n return parseInt(element.css('border-' + edge + '-width'), 10);\n }\n\n /**\n * Return the desired height of the panel to maintain both offsets.\n */\n function calculatePanelSize() {\n var available = $(window).height();\n if (edge === 'top' || edge === 'bottom') {\n available = $(window).width();\n }\n return available - parseInt(settings.otherOffset) - parseInt(settings.offset);\n }\n\n var panel = this;\n\n /**\n * True if the tab is open.\n *\n * @returns boolean\n */\n function isOpen() {\n return panel.hasClass('ui-slideouttab-open');\n }\n\n if (typeof callerSettings === 'string') {\n // param is a string, use command mode\n switch (callerSettings) {\n case 'open':\n this.trigger('open');\n return this;\n case 'close':\n this.trigger('close');\n return this;\n case 'isOpen':\n return isOpen();\n case 'toggle':\n this.trigger('toggle');\n return this;\n case 'bounce':\n this.trigger('bounce');\n return this;\n default:\n throw new Error('Invalid tabSlideOut command');\n }\n } else {\n // param is an object, it's initialisation mode\n var settings = $.extend({\n tabLocation: 'left', // left, right, top or bottom\n tabHandle: '.handle', // JQuery selector for the tab, can use any JQuery selector\n action: 'click', // action which will open the panel, e.g. 'hover'\n hoverTimeout: 5000, // ms to keep tab open after no longer hovered - only if action = 'hover'\n offset: '200px', // panel dist from top or left (bottom or right if offsetReverse is true)\n offsetReverse: false, // if true, panel is offset from right or bottom of window instead of left or top\n otherOffset: null, // if set, panel size is also set to maintain this dist from bottom or right of view port (top or left if offsetReverse)\n handleOffset: null, // e.g. '10px'. If null, detects panel border to align handle nicely on edge\n handleOffsetReverse: false, // if true, handle is offset from right or bottom of panel instead of left or top\n bounceDistance: '50px', // how far bounce event will move everything\n bounceTimes: 4, // how many bounces when 'bounce' is called\n bounceSpeed: 300, // time to animate bounces\n tabImage: null, // optional image to show in the tab\n tabImageHeight: null, // optional IE8 and lower only, else autodetected size\n tabImageWidth: null, // optional IE8 and lower only, else autodetected size\n onLoadSlideOut: false, // slide out after DOM load\n clickScreenToClose: true, // close tab when somewhere outside the tab is clicked\n clickScreenToCloseFilters: ['.ui-slideouttab-panel'], // if click target or parents match any of these, click won't close this tab\n onOpen: function() {}, // handler called after opening\n onClose: function() {} // handler called after closing\n }, callerSettings || {});\n\n var edge = settings.tabLocation;\n var handle = settings.tabHandle = $(settings.tabHandle, panel);\n\n panel.addClass('ui-slideouttab-panel')\n .addClass('ui-slideouttab-' + edge);\n if (settings.offsetReverse) {\n panel.addClass('ui-slideouttab-panel-reverse');\n }\n handle.addClass('ui-slideouttab-handle'); // need this to find it later\n if (settings.handleOffsetReverse) {\n handle.addClass('ui-slideouttab-handle-reverse');\n }\n settings.toggleButton = $(settings.toggleButton);\n\n // apply an image to the tab if one is defined\n if (settings.tabImage !== null) {\n var imageHeight = 0;\n var imageWidth = 0;\n if (settings.tabImageHeight !== null && settings.tabImageWidth !== null) {\n imageHeight = settings.tabImageHeight;\n imageWidth = settings.tabImageWidth;\n } else {\n var img = new Image();\n img.src = settings.tabImage;\n imageHeight = img.naturalHeight;\n imageWidth = img.naturalWidth;\n }\n\n handle.addClass('ui-slideouttab-handle-image');\n handle.css({\n 'background': 'url(' + settings.tabImage + ') no-repeat',\n 'width': imageWidth,\n 'height': imageHeight\n });\n }\n\n // determine whether panel and handle are positioned from top, bottom, left, or right\n if (edge === 'top' || edge === 'bottom') {\n settings.panelOffsetFrom =\n settings.offsetReverse ? 'right' : 'left';\n settings.handleOffsetFrom =\n settings.handleOffsetReverse ? 'right' : 'left';\n } else {\n settings.panelOffsetFrom =\n settings.offsetReverse ? 'bottom' : 'top';\n settings.handleOffsetFrom =\n settings.handleOffsetReverse ? 'bottom' : 'top';\n }\n\n /* autodetect the correct offset for the handle using appropriate panel border */\n if (settings.handleOffset === null) {\n settings.handleOffset = '-' + borderWidth(panel, settings.handleOffsetFrom) + 'px';\n }\n\n if (edge === 'top' || edge === 'bottom') {\n /* set left or right edges */\n panel.css(settings.panelOffsetFrom, settings.offset);\n handle.css(settings.handleOffsetFrom, settings.handleOffset);\n\n // possibly drive the panel size\n if (settings.otherOffset !== null) {\n panel.css('width', calculatePanelSize() + 'px');\n // install resize handler\n $(window).resize(function() {\n panel.css('width', calculatePanelSize() + 'px');\n });\n }\n\n if (edge === 'top') {\n handle.css({'bottom': '-' + heightAsString(handle)});\n } else {\n handle.css({'top': '-' + heightAsString(handle)});\n }\n } else {\n /* set top or bottom edge */\n panel.css(settings.panelOffsetFrom, settings.offset);\n handle.css(settings.handleOffsetFrom, settings.handleOffset);\n\n // possibly drive the panel size\n if (settings.otherOffset !== null) {\n panel.css('height', calculatePanelSize() + 'px');\n // install resize handler\n $(window).resize(function() {\n panel.css('height', calculatePanelSize() + 'px');\n });\n }\n\n if (edge === 'left') {\n handle.css({'right': '0'});\n } else {\n handle.css({'left': '0'});\n }\n }\n\n handle.click(function(event) {\n event.preventDefault();\n });\n settings.toggleButton.click(function(event) {\n event.preventDefault();\n });\n\n // now everything is set up, add the class which enables CSS tab animation\n panel.addClass('ui-slideouttab-ready');\n\n var close = function() {\n panel.removeClass('ui-slideouttab-open').trigger('slideouttabclose');\n settings.onClose();\n };\n\n var open = function() {\n panel.addClass('ui-slideouttab-open').trigger('slideouttabopen');\n settings.onOpen();\n };\n\n var toggle = function() {\n if (isOpen()) {\n close();\n } else {\n open();\n }\n };\n\n // animate the tab in and out when 'bounced'\n var moveIn = [];\n moveIn[edge] = '-=' + settings.bounceDistance;\n var moveOut = [];\n moveOut[edge] = '+=' + settings.bounceDistance;\n\n var bounceIn = function() {\n var temp = panel;\n for (var i = 0; i < settings.bounceTimes; i++) {\n temp = temp.animate(moveIn, settings.bounceSpeed)\n .animate(moveOut, settings.bounceSpeed);\n }\n panel.trigger('slideouttabbounce');\n };\n\n var bounceOut = function() {\n var temp = panel;\n for (var i = 0; i < settings.bounceTimes; i++) {\n temp = temp.animate(moveOut, settings.bounceSpeed)\n .animate(moveIn, settings.bounceSpeed);\n }\n panel.trigger('slideouttabbounce');\n };\n\n // handle clicks in rest of document to close tabs if they're open\n if (settings.clickScreenToClose) {\n // install a click handler to close tab if anywhere outside the tab is clicked,\n // that isn't filtered out by the configured filters\n $(document).click(function(event) {\n // first check the tab is open and the click isn't inside it\n if (isOpen() && !panel[0].contains(event.target)) {\n // something other than this panel was clicked\n var clicked = $(event.target);\n\n // check to see if any filters return true\n for (var i = 0; i < settings.clickScreenToCloseFilters.length; i++) {\n var filter = settings.clickScreenToCloseFilters[i];\n if (typeof filter === 'string') {\n // checked clicked element itself, and all parents\n if (clicked.is(filter) || clicked.parents().is(filter)) {\n return; // don't close the tab\n }\n } else if (typeof filter === 'function') {\n // call custom filter\n if (filter.call(panel, event)) {\n return;\n } // don't close the tab\n }\n }\n\n // we haven't returned true from any filter, so close the tab\n close();\n }\n });\n };\n\n // choose which type of action to bind\n if (settings.action === 'click') {\n handle.click(function(event) {\n toggle();\n });\n } else if (settings.action === 'hover') {\n var timer = null;\n panel.hover(\n function() {\n if (!isOpen()) {\n open();\n }\n timer = null; // eliminate the timer, ensure we don't close now\n },\n function() {\n if (isOpen() && timer === null) {\n timer = setTimeout(function() {\n if (timer) {\n close();\n }\n timer = null;\n }, settings.hoverTimeout);\n }\n });\n\n handle.click(function(event) {\n if (isOpen()) {\n close();\n }\n });\n }\n\n if (settings.onLoadSlideOut) {\n open();\n setTimeout(open, 500);\n }\n\n // custom event handlers -------\n panel.on('open', function(event) {\n if (!isOpen()) {\n open();\n }\n });\n panel.on('close', function(event) {\n if (isOpen()) {\n close();\n }\n });\n panel.on('toggle', function(event) {\n toggle();\n });\n panel.on('bounce', function(event) {\n if (isOpen()) {\n bounceIn();\n } else {\n bounceOut();\n }\n });\n\n }\n return this;\n };\n})(jQuery);\n",
"/**\n * Copyright (C) 2019 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport {staticAsset} from 'utils/functions';\n\n// Constants defining Bootstrap Breakpoints\nexport const BREAKPOINT_SM = 768;\nexport const BREAKPOINT_MD = 992;\nexport const BREAKPOINT_LG = 1200;\n\nexport const swhSpinnerSrc = staticAsset('img/swh-spinner.gif');\n",
"/**\n * Copyright (C) 2018-2022 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\n// utility functions\n\nimport Cookies from 'js-cookie';\n\nexport function handleFetchError(response) {\n if (!response.ok) {\n throw response;\n }\n return response;\n}\n\nexport function handleFetchErrors(responses) {\n for (let i = 0; i < responses.length; ++i) {\n if (!responses[i].ok) {\n throw responses[i];\n }\n }\n return responses;\n}\n\nexport function errorMessageFromResponse(errorData, defaultMessage) {\n let errorMessage = '';\n try {\n const reason = JSON.parse(errorData['reason']);\n Object.entries(reason).forEach((keys, _) => {\n const key = keys[0];\n const message = keys[1][0]; // take only the first issue\n errorMessage += `\\n${key}: ${message}`;\n });\n } catch (_) {\n errorMessage = errorData['reason']; // can't parse it, leave it raw\n }\n return errorMessage ? `Error: ${errorMessage}` : defaultMessage;\n}\n\nexport function staticAsset(asset) {\n return `${__STATIC__}${asset}`;\n}\n\nexport function csrfPost(url, headers = {}, body = null) {\n headers['X-CSRFToken'] = Cookies.get('csrftoken');\n return fetch(url, {\n credentials: 'include',\n headers: headers,\n method: 'POST',\n body: body\n });\n}\n\nexport function isGitRepoUrl(url, pathPrefix = '/') {\n const allowedProtocols = ['http:', 'https:', 'git:'];\n if (allowedProtocols.find(protocol => protocol === url.protocol) === undefined) {\n return false;\n }\n if (!url.pathname.startsWith(pathPrefix)) {\n return false;\n }\n const re = new RegExp('[\\\\w\\\\.-]+\\\\/?(?!=.git)(?:\\\\.git\\\\/?)?$');\n return re.test(url.pathname.slice(pathPrefix.length));\n};\n\nexport function removeUrlFragment() {\n history.replaceState('', document.title, window.location.pathname + window.location.search);\n}\n\nexport function selectText(startNode, endNode) {\n const selection = window.getSelection();\n selection.removeAllRanges();\n const range = document.createRange();\n range.setStart(startNode, 0);\n if (endNode.nodeName !== '#text') {\n range.setEnd(endNode, endNode.childNodes.length);\n } else {\n range.setEnd(endNode, endNode.textContent.length);\n }\n selection.addRange(range);\n}\n\nexport function htmlAlert(type, message, closable = false) {\n let closeButton = '';\n let extraClasses = '';\n if (closable) {\n closeButton =\n `<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>`;\n extraClasses = 'alert-dismissible';\n }\n return `<div class=\"alert alert-${type} ${extraClasses}\" role=\"alert\">${message}${closeButton}</div>`;\n}\n\nexport function validateUrl(url, allowedProtocols = []) {\n let originUrl = null;\n let validUrl = true;\n\n try {\n originUrl = new URL(url);\n } catch (TypeError) {\n validUrl = false;\n }\n\n if (validUrl && allowedProtocols.length) {\n validUrl = (\n allowedProtocols.find(protocol => protocol === originUrl.protocol) !== undefined\n );\n }\n\n return validUrl ? originUrl : null;\n}\n\nexport async function isArchivedOrigin(originPath) {\n if (!validateUrl(originPath)) {\n // Not a valid URL, return immediately\n return false;\n } else {\n const response = await fetch(Urls.api_1_origin(originPath));\n return response.ok && response.status === 200; // Success response represents an archived origin\n }\n}\n\nasync function getCanonicalGithubOriginURL(ownerRepo) {\n const ghApiResponse = await fetch(`https://api.github.com/repos/${ownerRepo}`);\n if (ghApiResponse.ok && ghApiResponse.status === 200) {\n const ghApiResponseData = await ghApiResponse.json();\n return ghApiResponseData.html_url;\n }\n}\n\nexport async function getCanonicalOriginURL(originUrl) {\n let originUrlLower = originUrl.toLowerCase();\n // github.com URL processing\n const ghUrlRegex = /^http[s]*:\\/\\/github.com\\//;\n if (originUrlLower.match(ghUrlRegex)) {\n // remove trailing .git\n if (originUrlLower.endsWith('.git')) {\n originUrlLower = originUrlLower.slice(0, -4);\n }\n // remove trailing slash\n if (originUrlLower.endsWith('/')) {\n originUrlLower = originUrlLower.slice(0, -1);\n }\n // extract {owner}/{repo}\n const ownerRepo = originUrlLower.replace(ghUrlRegex, '');\n // fetch canonical URL from github Web API\n const url = await getCanonicalGithubOriginURL(ownerRepo);\n if (url) {\n return url;\n }\n }\n\n const ghpagesUrlRegex = /^http[s]*:\\/\\/(?<owner>[^/]+).github.io\\/(?<repo>[^/]+)\\/?.*/;\n const parsedUrl = originUrlLower.match(ghpagesUrlRegex);\n if (parsedUrl) {\n const ownerRepo = `${parsedUrl.groups.owner}/${parsedUrl.groups.repo}`;\n // fetch canonical URL from github Web API\n const url = await getCanonicalGithubOriginURL(ownerRepo);\n if (url) {\n return url;\n }\n }\n\n return originUrl;\n}\n\nexport function getHumanReadableDate(data) {\n // Display iso format date string into a human readable date\n // This is expected to be used by date field in datatable listing views\n // Example: 3/24/2022, 10:31:08 AM\n const date = new Date(data);\n return date.toLocaleString();\n}\n\nexport function genLink(sanitizedUrl, type, openInNewTab = false, linkText = '') {\n // Display link. It's up to the caller to sanitize sanitizedUrl first.\n if (type === 'display' && sanitizedUrl) {\n const encodedSanitizedUrl = encodeURI(sanitizedUrl);\n if (!linkText) {\n linkText = encodedSanitizedUrl;\n }\n let attrs = '';\n if (openInNewTab) {\n attrs = 'target=\"_blank\" rel=\"noopener noreferrer\"';\n }\n return `<a href=\"${encodedSanitizedUrl}\" ${attrs}>${linkText}</a>`;\n }\n return sanitizedUrl;\n}\n",
"/**\n * Copyright (C) 2018-2021 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport {BREAKPOINT_SM} from 'utils/constants';\n\n$(document).ready(() => {\n\n $('.dropdown-submenu a.dropdown-item').on('click', e => {\n $(e.target).next('div').toggle();\n if ($(e.target).next('div').css('display') !== 'none') {\n $(e.target).focus();\n } else {\n $(e.target).blur();\n }\n e.stopPropagation();\n e.preventDefault();\n });\n\n $('.swh-popover-toggler').popover({\n boundary: 'viewport',\n container: 'body',\n html: true,\n placement: function() {\n const width = $(window).width();\n if (width < BREAKPOINT_SM) {\n return 'top';\n } else {\n return 'right';\n }\n },\n template: `<div class=\"popover\" role=\"tooltip\">\n <div class=\"arrow\"></div>\n <h3 class=\"popover-header\"></h3>\n <div class=\"popover-body swh-popover\"></div>\n </div>`,\n content: function() {\n var content = $(this).attr('data-popover-content');\n return $(content).children('.popover-body').remove().html();\n },\n title: function() {\n var title = $(this).attr('data-popover-content');\n return $(title).children('.popover-heading').html();\n },\n offset: '50vh',\n sanitize: false\n });\n\n $('.swh-vault-menu a.dropdown-item').on('click', e => {\n $('.swh-popover-toggler').popover('hide');\n });\n\n $('.swh-popover-toggler').on('show.bs.popover', (e) => {\n $(`.swh-popover-toggler:not(#${e.currentTarget.id})`).popover('hide');\n $('.swh-vault-menu .dropdown-menu').hide();\n });\n\n $('.swh-actions-dropdown').on('hide.bs.dropdown', () => {\n $('.swh-vault-menu .dropdown-menu').hide();\n $('.swh-popover-toggler').popover('hide');\n });\n\n $('#swh-branch-search-form').submit(function(e) {\n var searchParams = new URLSearchParams(window.location.search);\n searchParams.set('name_include',\n $('#swh-branch-search-string').val().trim());\n window.location.search = searchParams.toString();\n e.preventDefault();\n });\n\n $('body').on('click', e => {\n if ($(e.target).parents('.swh-popover').length) {\n e.stopPropagation();\n }\n });\n\n});\n\nexport function initBrowseNavbar() {\n if (window.location.pathname === Urls.browse_origin_visits()) {\n $('#swh-browse-origin-visits-nav-link').addClass('active');\n } else if (window.location.pathname === Urls.browse_origin_branches() ||\n window.location.pathname === Urls.browse_snapshot_branches() ||\n window.location.pathname.endsWith('branches/')) {\n $('#swh-browse-snapshot-branches-nav-link').addClass('active');\n } else if (window.location.pathname === Urls.browse_origin_releases() ||\n window.location.pathname === Urls.browse_snapshot_releases() ||\n window.location.pathname.endsWith('releases/')) {\n $('#swh-browse-snapshot-releases-nav-link').addClass('active');\n } else {\n $('#swh-browse-code-nav-link').addClass('active');\n }\n}\n",
"/**\n * Copyright (C) 2021-2022 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nexport function showIframeInfoModal(objectType, objectSWHID) {\n const html = `\n <p>\n You can embed that ${objectType} view in an external website\n through the use of an iframe. Use the following HTML code\n to do so.\n </p>\n <pre><code class=\"swh-iframe-html html\"><iframe style=\"width: 100%; height: 500px; border: 1px solid rgba(0, 0, 0, 0.125);\"\n src=\"${window.location.origin}${Urls.browse_swhid_iframe(objectSWHID.replaceAll('\\n', ''))}\">\n</iframe></code></pre>\n <iframe style=\"width: 100%; height: 500px; border: 1px solid rgba(0, 0, 0, 0.125);\"\n src=\"${window.location.origin}${Urls.browse_swhid_iframe(objectSWHID.replaceAll('\\n', ''))}\">\n </iframe>`;\n swh.webapp.showModalHtml(`Software Heritage ${objectType} iframe`, html, '1000px');\n swh.webapp.highlightCode(false, '.swh-iframe-html');\n}\n",
"/**\n * Copyright (C) 2018-2022 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport {errorMessageFromResponse, handleFetchError, isArchivedOrigin} from 'utils/functions';\n\nconst limit = 100;\nconst linksPrev = [];\nlet linkNext = null;\nlet linkCurrent = null;\nlet inSearch = false;\n\nfunction parseLinkHeader(s) {\n const re = /<(.+)>; rel=\"next\"/;\n return s.match(re)[1];\n}\n\nfunction fixTableRowsStyle() {\n setTimeout(() => {\n $('#origin-search-results tbody tr').removeAttr('style');\n });\n}\n\nfunction clearOriginSearchResultsTable() {\n $('#origin-search-results tbody tr').remove();\n}\n\nasync function populateOriginSearchResultsTable(origins) {\n if (origins.length > 0) {\n $('#swh-origin-search-results').show();\n $('#swh-no-result').hide();\n clearOriginSearchResultsTable();\n const table = $('#origin-search-results tbody');\n const promises = [];\n for (const [i, origin] of origins.entries()) {\n const browseUrl = `${Urls.browse_origin()}?origin_url=${encodeURIComponent(origin.url)}`;\n let tableRow =\n `<tr id=\"origin-${i}\" class=\"swh-search-result-entry swh-tr-hover-highlight\">`;\n tableRow +=\n `<td id=\"visit-type-origin-${i}\" class=\"swh-origin-visit-type\" style=\"width: 120px;\">` +\n '<i title=\"Checking software origin type\" class=\"mdi mdi-sync mdi-spin mdi-fw\"></i>' +\n 'Checking</td>';\n tableRow +=\n '<td style=\"white-space: nowrap;\">' +\n `<a href=\"${browseUrl}\">${origin.url}</a></td>`;\n tableRow +=\n `<td class=\"swh-visit-status\" id=\"visit-status-origin-${i}\">` +\n '<i title=\"Checking archiving status\" class=\"mdi mdi-sync mdi-spin mdi-fw\"></i>' +\n 'Checking</td>';\n tableRow += '</tr>';\n table.append(tableRow);\n // get async latest visit snapshot and update visit status icon\n let latestSnapshotUrl = Urls.api_1_origin_visit_latest(origin.url.replace('?', '%3F'));\n latestSnapshotUrl += '?require_snapshot=true';\n promises.push(fetch(latestSnapshotUrl));\n }\n const responses = await Promise.all(promises);\n const responsesData = await Promise.all(responses.map(r => r.json()));\n for (let i = 0; i < responses.length; ++i) {\n const response = responses[i];\n const data = responsesData[i];\n if (response.status !== 404 && data.type) {\n $(`#visit-type-origin-${i}`).html(data.type);\n $(`#visit-status-origin-${i}`).html(\n '<i title=\"Software origin has been archived by Software Heritage\" ' +\n 'class=\"mdi mdi-check-bold mdi-fw\"></i>Archived');\n } else {\n $(`#visit-type-origin-${i}`).html('unknown');\n $(`#visit-status-origin-${i}`).html(\n '<i title=\"Software origin archival by Software Heritage is pending\" ' +\n 'class=\"mdi mdi-close-thick mdi-fw\"></i>Pending archival');\n if ($('#swh-filter-empty-visits').prop('checked')) {\n $(`#origin-${i}`).remove();\n }\n }\n }\n fixTableRowsStyle();\n } else {\n $('#swh-origin-search-results').hide();\n $('#swh-no-result').text('No origins matching the search criteria were found.');\n $('#swh-no-result').show();\n }\n\n if (linkNext === null) {\n $('#origins-next-results-button').addClass('disabled');\n } else {\n $('#origins-next-results-button').removeClass('disabled');\n }\n\n if (linksPrev.length === 0) {\n $('#origins-prev-results-button').addClass('disabled');\n } else {\n $('#origins-prev-results-button').removeClass('disabled');\n }\n\n inSearch = false;\n setTimeout(() => {\n window.scrollTo(0, 0);\n });\n}\n\nfunction searchOriginsFirst(searchQueryText, limit) {\n let baseSearchUrl;\n const searchMetadata = $('#swh-search-origin-metadata').prop('checked');\n if (searchMetadata) {\n baseSearchUrl = new URL(Urls.api_1_origin_metadata_search(), window.location);\n baseSearchUrl.searchParams.append('fulltext', searchQueryText);\n } else {\n const useSearchQL = $('#swh-search-use-ql').prop('checked');\n baseSearchUrl = new URL(Urls.api_1_origin_search(searchQueryText), window.location);\n baseSearchUrl.searchParams.append('use_ql', useSearchQL ?? false);\n }\n\n const withVisit = $('#swh-search-origins-with-visit').prop('checked');\n baseSearchUrl.searchParams.append('limit', limit);\n baseSearchUrl.searchParams.append('with_visit', withVisit);\n const visitType = $('#swh-search-visit-type').val();\n if (visitType !== 'any') {\n baseSearchUrl.searchParams.append('visit_type', visitType);\n }\n const searchUrl = baseSearchUrl.toString();\n searchOrigins(searchUrl);\n}\n\nasync function searchOrigins(searchUrl) {\n clearOriginSearchResultsTable();\n $('.swh-loading').addClass('show');\n try {\n const response = await fetch(searchUrl);\n handleFetchError(response);\n const data = await response.json();\n // Save link to the current results page\n linkCurrent = searchUrl;\n // Save link to the next results page.\n linkNext = null;\n if (response.headers.has('Link')) {\n const parsedLink = parseLinkHeader(response.headers.get('Link'));\n if (parsedLink !== undefined) {\n linkNext = parsedLink;\n }\n }\n // prevLinks is updated by the caller, which is the one to know if\n // we're going forward or backward in the pages.\n\n $('.swh-loading').removeClass('show');\n populateOriginSearchResultsTable(data);\n } catch (errorResponse) {\n const errorData = await errorResponse.json();\n $('.swh-loading').removeClass('show');\n inSearch = false;\n $('#swh-origin-search-results').hide();\n $('#swh-no-result').text(errorMessageFromResponse(\n errorData, 'An unknown error occurred while searching origins'));\n $('#swh-no-result').show();\n }\n}\n\nasync function doSearch() {\n $('#swh-no-result').hide();\n const searchQueryText = $('#swh-origins-url-patterns').val();\n inSearch = true;\n if (searchQueryText.startsWith('swh:')) {\n try {\n // searchQueryText may be a PID so sending search queries to PID resolve endpoint\n const resolveSWHIDUrl = Urls.api_1_resolve_swhid(searchQueryText);\n const response = await fetch(resolveSWHIDUrl);\n handleFetchError(response);\n const data = await response.json();\n // SWHID has been successfully resolved,\n // so redirect to browse page\n window.location = data.browse_url;\n } catch (response) {\n // display a useful error message if the input\n // looks like a SWHID\n const data = await response.json();\n $('#swh-origin-search-results').hide();\n $('.swh-search-pagination').hide();\n $('#swh-no-result').text(data.reason);\n $('#swh-no-result').show();\n }\n } else if (await isArchivedOrigin(searchQueryText)) {\n // redirect to the browse origin\n window.location.href =\n `${Urls.browse_origin()}?origin_url=${encodeURIComponent(searchQueryText)}`;\n } else {\n // otherwise, proceed with origins search irrespective of the error\n $('#swh-origin-search-results').show();\n $('.swh-search-pagination').show();\n searchOriginsFirst(searchQueryText, limit);\n }\n}\n\nexport function initOriginSearch() {\n $(document).ready(() => {\n $('#swh-search-origins').submit(event => {\n event.preventDefault();\n if (event.target.checkValidity()) {\n $(event.target).removeClass('was-validated');\n const searchQueryText = $('#swh-origins-url-patterns').val().trim();\n const withVisit = $('#swh-search-origins-with-visit').prop('checked');\n const withContent = $('#swh-filter-empty-visits').prop('checked');\n const useSearchQL = $('#swh-search-use-ql').prop('checked');\n const searchMetadata = $('#swh-search-origin-metadata').prop('checked');\n const visitType = $('#swh-search-visit-type').val();\n const queryParameters = new URLSearchParams();\n queryParameters.append('q', searchQueryText);\n if (withVisit) {\n queryParameters.append('with_visit', withVisit);\n }\n if (withContent) {\n queryParameters.append('with_content', withContent);\n }\n if (useSearchQL) {\n queryParameters.append('use_ql', useSearchQL ?? false);\n }\n if (searchMetadata) {\n queryParameters.append('search_metadata', searchMetadata);\n }\n if (visitType !== 'any') {\n queryParameters.append('visit_type', visitType);\n }\n // Update the url, triggering page reload and effective search\n window.location = `${Urls.browse_search()}?${queryParameters.toString()}`;\n } else {\n $(event.target).addClass('was-validated');\n }\n });\n\n $('#origins-next-results-button').click(event => {\n if ($('#origins-next-results-button').hasClass('disabled') || inSearch) {\n return;\n }\n inSearch = true;\n linksPrev.push(linkCurrent);\n searchOrigins(linkNext);\n event.preventDefault();\n });\n\n $('#origins-prev-results-button').click(event => {\n if ($('#origins-prev-results-button').hasClass('disabled') || inSearch) {\n return;\n }\n inSearch = true;\n searchOrigins(linksPrev.pop());\n event.preventDefault();\n });\n\n if (window.location.search) {\n const urlParams = new URLSearchParams(window.location.search);\n const query = urlParams.get('q');\n const withVisit = urlParams.has('with_visit');\n const useSearchQL = urlParams.has('use_ql');\n const withContent = urlParams.has('with_content');\n const searchMetadata = urlParams.has('search_metadata');\n const visitType = urlParams.get('visit_type');\n\n $('#swh-origins-url-patterns').val(query);\n $('#swh-search-origins-with-visit').prop('checked', withVisit);\n $('#swh-search-use-ql').prop('checked', useSearchQL ?? false);\n $('#swh-filter-empty-visits').prop('checked', withContent);\n $('#swh-search-origin-metadata').prop('checked', searchMetadata);\n if (visitType) {\n $('#swh-search-visit-type').val(visitType);\n }\n doSearch();\n }\n });\n}\n",
"/**\n * Copyright (C) 2018 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nexport function initSnapshotNavigation(snapshotContext, branch) {\n\n function setBranchesTabActive() {\n $('.swh-releases-switch').removeClass('active');\n $('.swh-branches-switch').addClass('active');\n $('#swh-tab-releases').removeClass('active');\n $('#swh-tab-branches').addClass('active');\n }\n\n function setReleasesTabActive() {\n $('.swh-branches-switch').removeClass('active');\n $('.swh-releases-switch').addClass('active');\n $('#swh-tab-branches').removeClass('active');\n $('#swh-tab-releases').addClass('active');\n }\n\n $(document).ready(() => {\n $('.dropdown-menu a.swh-branches-switch').click(e => {\n setBranchesTabActive();\n e.stopPropagation();\n });\n\n $('.dropdown-menu a.swh-releases-switch').click(e => {\n setReleasesTabActive();\n e.stopPropagation();\n });\n\n let dropdownResized = false;\n\n // hack to resize the branches/releases dropdown content,\n // taking icons into account, in order to make the whole names readable\n $('#swh-branches-releases-dd').on('show.bs.dropdown', () => {\n if (dropdownResized) return;\n const dropdownWidth = $('.swh-branches-releases').width();\n $('.swh-branches-releases').width(dropdownWidth + 25);\n dropdownResized = true;\n });\n\n if (snapshotContext) {\n if (branch) {\n setBranchesTabActive();\n } else {\n setReleasesTabActive();\n }\n }\n\n });\n\n}\n",
"/**\n * Copyright (C) 2018-2021 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport ClipboardJS from 'clipboard';\nimport 'thirdparty/jquery.tabSlideOut/jquery.tabSlideOut';\nimport 'thirdparty/jquery.tabSlideOut/jquery.tabSlideOut.css';\n\nimport {BREAKPOINT_SM} from 'utils/constants';\n\nexport function swhIdObjectTypeToggled(event) {\n event.preventDefault();\n $(event.target).tab('show');\n}\n\nexport function swhIdContextOptionToggled(event) {\n event.stopPropagation();\n const swhIdElt = $(event.target).closest('.swhid-ui').find('.swhid');\n const swhIdWithContext = $(event.target).data('swhid-with-context');\n const swhIdWithContextUrl = $(event.target).data('swhid-with-context-url');\n let currentSwhId = swhIdElt.text();\n if ($(event.target).prop('checked')) {\n swhIdElt.attr('href', swhIdWithContextUrl);\n currentSwhId = swhIdWithContext.replace(/;/g, ';\\n');\n } else {\n const pos = currentSwhId.indexOf(';');\n if (pos !== -1) {\n currentSwhId = currentSwhId.slice(0, pos);\n }\n swhIdElt.attr('href', '/' + currentSwhId);\n }\n swhIdElt.text(currentSwhId);\n\n addLinesInfo();\n}\n\nfunction addLinesInfo() {\n const swhIdElt = $('#swhid-tab-content').find('.swhid');\n let currentSwhId = swhIdElt.text().replace(/;\\n/g, ';');\n const lines = [];\n let linesPart = ';lines=';\n const linesRegexp = new RegExp(/L(\\d+)/g);\n let line = linesRegexp.exec(window.location.hash);\n while (line) {\n lines.push(parseInt(line[1]));\n line = linesRegexp.exec(window.location.hash);\n }\n if (lines.length > 0) {\n linesPart += lines[0];\n }\n if (lines.length > 1) {\n linesPart += '-' + lines[1];\n }\n\n if ($('#swhid-context-option-content').prop('checked')) {\n currentSwhId = currentSwhId.replace(/;lines=\\d+-*\\d*/g, '');\n if (lines.length > 0) {\n currentSwhId += linesPart;\n }\n\n swhIdElt.text(currentSwhId.replace(/;/g, ';\\n'));\n swhIdElt.attr('href', '/' + currentSwhId);\n }\n}\n\n$(document).ready(() => {\n new ClipboardJS('.btn-swhid-copy', {\n text: trigger => {\n const swhId = $(trigger).closest('.swhid-ui').find('.swhid').text();\n return swhId.replace(/;\\n/g, ';');\n }\n });\n\n new ClipboardJS('.btn-swhid-url-copy', {\n text: trigger => {\n const swhIdUrl = $(trigger).closest('.swhid-ui').find('.swhid').attr('href');\n return window.location.origin + swhIdUrl;\n }\n });\n\n if (window.innerWidth * 0.7 > 1000) {\n $('#swh-identifiers').css('width', '1000px');\n }\n\n // prevent automatic closing of SWHIDs tab during guided tour\n // as it is displayed programmatically\n function clickScreenToCloseFilter() {\n return $('.introjs-overlay').length > 0;\n }\n\n const tabSlideOptions = {\n tabLocation: 'right',\n clickScreenToCloseFilters: [clickScreenToCloseFilter, '.ui-slideouttab-panel', '.modal'],\n offset: function() {\n const width = $(window).width();\n if (width < BREAKPOINT_SM) {\n return '250px';\n } else {\n return '200px';\n }\n }\n };\n // ensure tab scrolling on small screens\n if (window.innerHeight < 600 || window.innerWidth < 500) {\n tabSlideOptions['otherOffset'] = '20px';\n }\n\n // initiate the sliding identifiers tab\n $('#swh-identifiers').tabSlideOut(tabSlideOptions);\n\n // set the tab visible once the close animation is terminated\n $('#swh-identifiers').addClass('d-none d-sm-block');\n $('.swhid-context-option').trigger('click');\n\n // highlighted code lines changed\n $(window).on('hashchange', () => {\n addLinesInfo();\n });\n\n // highlighted code lines removed\n $('body').click(() => {\n addLinesInfo();\n });\n\n});\n",
"/*!\n * clipboard.js v2.0.11\n * https://clipboardjs.com/\n *\n * Licensed MIT \u00a9 Zeno Rocha\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ClipboardJS\"] = factory();\n\telse\n\t\troot[\"ClipboardJS\"] = factory();\n})(this, function() {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 686:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n\"default\": function() { return /* binding */ clipboard; }\n});\n\n// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js\nvar tiny_emitter = __webpack_require__(279);\nvar tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);\n// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js\nvar listen = __webpack_require__(370);\nvar listen_default = /*#__PURE__*/__webpack_require__.n(listen);\n// EXTERNAL MODULE: ./node_modules/select/src/select.js\nvar src_select = __webpack_require__(817);\nvar select_default = /*#__PURE__*/__webpack_require__.n(src_select);\n;// CONCATENATED MODULE: ./src/common/command.js\n/**\n * Executes a given operation type.\n * @param {String} type\n * @return {Boolean}\n */\nfunction command(type) {\n try {\n return document.execCommand(type);\n } catch (err) {\n return false;\n }\n}\n;// CONCATENATED MODULE: ./src/actions/cut.js\n\n\n/**\n * Cut action wrapper.\n * @param {String|HTMLElement} target\n * @return {String}\n */\n\nvar ClipboardActionCut = function ClipboardActionCut(target) {\n var selectedText = select_default()(target);\n command('cut');\n return selectedText;\n};\n\n/* harmony default export */ var actions_cut = (ClipboardActionCut);\n;// CONCATENATED MODULE: ./src/common/create-fake-element.js\n/**\n * Creates a fake textarea element with a value.\n * @param {String} value\n * @return {HTMLElement}\n */\nfunction createFakeElement(value) {\n var isRTL = document.documentElement.getAttribute('dir') === 'rtl';\n var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS\n\n fakeElement.style.fontSize = '12pt'; // Reset box model\n\n fakeElement.style.border = '0';\n fakeElement.style.padding = '0';\n fakeElement.style.margin = '0'; // Move element out of screen horizontally\n\n fakeElement.style.position = 'absolute';\n fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically\n\n var yPosition = window.pageYOffset || document.documentElement.scrollTop;\n fakeElement.style.top = \"\".concat(yPosition, \"px\");\n fakeElement.setAttribute('readonly', '');\n fakeElement.value = value;\n return fakeElement;\n}\n;// CONCATENATED MODULE: ./src/actions/copy.js\n\n\n\n/**\n * Create fake copy action wrapper using a fake element.\n * @param {String} target\n * @param {Object} options\n * @return {String}\n */\n\nvar fakeCopyAction = function fakeCopyAction(value, options) {\n var fakeElement = createFakeElement(value);\n options.container.appendChild(fakeElement);\n var selectedText = select_default()(fakeElement);\n command('copy');\n fakeElement.remove();\n return selectedText;\n};\n/**\n * Copy action wrapper.\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @return {String}\n */\n\n\nvar ClipboardActionCopy = function ClipboardActionCopy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n var selectedText = '';\n\n if (typeof target === 'string') {\n selectedText = fakeCopyAction(target, options);\n } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) {\n // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n selectedText = fakeCopyAction(target.value, options);\n } else {\n selectedText = select_default()(target);\n command('copy');\n }\n\n return selectedText;\n};\n\n/* harmony default export */ var actions_copy = (ClipboardActionCopy);\n;// CONCATENATED MODULE: ./src/actions/default.js\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n\n\n/**\n * Inner function which performs selection from either `text` or `target`\n * properties and then executes copy or cut operations.\n * @param {Object} options\n */\n\nvar ClipboardActionDefault = function ClipboardActionDefault() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // Defines base properties passed from constructor.\n var _options$action = options.action,\n action = _options$action === void 0 ? 'copy' : _options$action,\n container = options.container,\n target = options.target,\n text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.\n\n if (action !== 'copy' && action !== 'cut') {\n throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n } // Sets the `target` property using an element that will be have its content copied.\n\n\n if (target !== undefined) {\n if (target && _typeof(target) === 'object' && target.nodeType === 1) {\n if (action === 'copy' && target.hasAttribute('disabled')) {\n throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n }\n\n if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n }\n } else {\n throw new Error('Invalid \"target\" value, use a valid Element');\n }\n } // Define selection strategy based on `text` property.\n\n\n if (text) {\n return actions_copy(text, {\n container: container\n });\n } // Defines which selection strategy based on `target` property.\n\n\n if (target) {\n return action === 'cut' ? actions_cut(target) : actions_copy(target, {\n container: container\n });\n }\n};\n\n/* harmony default export */ var actions_default = (ClipboardActionDefault);\n;// CONCATENATED MODULE: ./src/clipboard.js\nfunction clipboard_typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return clipboard_typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n/**\n * Helper function to retrieve attribute value.\n * @param {String} suffix\n * @param {Element} element\n */\n\nfunction getAttributeValue(suffix, element) {\n var attribute = \"data-clipboard-\".concat(suffix);\n\n if (!element.hasAttribute(attribute)) {\n return;\n }\n\n return element.getAttribute(attribute);\n}\n/**\n * Base class which takes one or more elements, adds event listeners to them,\n * and instantiates a new `ClipboardAction` on each click.\n */\n\n\nvar Clipboard = /*#__PURE__*/function (_Emitter) {\n _inherits(Clipboard, _Emitter);\n\n var _super = _createSuper(Clipboard);\n\n /**\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n * @param {Object} options\n */\n function Clipboard(trigger, options) {\n var _this;\n\n _classCallCheck(this, Clipboard);\n\n _this = _super.call(this);\n\n _this.resolveOptions(options);\n\n _this.listenClick(trigger);\n\n return _this;\n }\n /**\n * Defines if attributes would be resolved using internal setter functions\n * or custom functions that were passed in the constructor.\n * @param {Object} options\n */\n\n\n _createClass(Clipboard, [{\n key: \"resolveOptions\",\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.action = typeof options.action === 'function' ? options.action : this.defaultAction;\n this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;\n this.text = typeof options.text === 'function' ? options.text : this.defaultText;\n this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;\n }\n /**\n * Adds a click event listener to the passed trigger.\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n */\n\n }, {\n key: \"listenClick\",\n value: function listenClick(trigger) {\n var _this2 = this;\n\n this.listener = listen_default()(trigger, 'click', function (e) {\n return _this2.onClick(e);\n });\n }\n /**\n * Defines a new `ClipboardAction` on each click event.\n * @param {Event} e\n */\n\n }, {\n key: \"onClick\",\n value: function onClick(e) {\n var trigger = e.delegateTarget || e.currentTarget;\n var action = this.action(trigger) || 'copy';\n var text = actions_default({\n action: action,\n container: this.container,\n target: this.target(trigger),\n text: this.text(trigger)\n }); // Fires an event based on the copy operation result.\n\n this.emit(text ? 'success' : 'error', {\n action: action,\n text: text,\n trigger: trigger,\n clearSelection: function clearSelection() {\n if (trigger) {\n trigger.focus();\n }\n\n window.getSelection().removeAllRanges();\n }\n });\n }\n /**\n * Default `action` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultAction\",\n value: function defaultAction(trigger) {\n return getAttributeValue('action', trigger);\n }\n /**\n * Default `target` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultTarget\",\n value: function defaultTarget(trigger) {\n var selector = getAttributeValue('target', trigger);\n\n if (selector) {\n return document.querySelector(selector);\n }\n }\n /**\n * Allow fire programmatically a copy action\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @returns Text copied.\n */\n\n }, {\n key: \"defaultText\",\n\n /**\n * Default `text` lookup function.\n * @param {Element} trigger\n */\n value: function defaultText(trigger) {\n return getAttributeValue('text', trigger);\n }\n /**\n * Destroy lifecycle.\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.listener.destroy();\n }\n }], [{\n key: \"copy\",\n value: function copy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n return actions_copy(target, options);\n }\n /**\n * Allow fire programmatically a cut action\n * @param {String|HTMLElement} target\n * @returns Text cutted.\n */\n\n }, {\n key: \"cut\",\n value: function cut(target) {\n return actions_cut(target);\n }\n /**\n * Returns the support of the given action, or all actions if no action is\n * given.\n * @param {String} [action]\n */\n\n }, {\n key: \"isSupported\",\n value: function isSupported() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];\n var actions = typeof action === 'string' ? [action] : action;\n var support = !!document.queryCommandSupported;\n actions.forEach(function (action) {\n support = support && !!document.queryCommandSupported(action);\n });\n return support;\n }\n }]);\n\n return Clipboard;\n}((tiny_emitter_default()));\n\n/* harmony default export */ var clipboard = (Clipboard);\n\n/***/ }),\n\n/***/ 828:\n/***/ (function(module) {\n\nvar DOCUMENT_NODE_TYPE = 9;\n\n/**\n * A polyfill for Element.matches()\n */\nif (typeof Element !== 'undefined' && !Element.prototype.matches) {\n var proto = Element.prototype;\n\n proto.matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector;\n}\n\n/**\n * Finds the closest parent that matches a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @return {Function}\n */\nfunction closest (element, selector) {\n while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {\n if (typeof element.matches === 'function' &&\n element.matches(selector)) {\n return element;\n }\n element = element.parentNode;\n }\n}\n\nmodule.exports = closest;\n\n\n/***/ }),\n\n/***/ 438:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar closest = __webpack_require__(828);\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction _delegate(element, selector, type, callback, useCapture) {\n var listenerFn = listener.apply(this, arguments);\n\n element.addEventListener(type, listenerFn, useCapture);\n\n return {\n destroy: function() {\n element.removeEventListener(type, listenerFn, useCapture);\n }\n }\n}\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element|String|Array} [elements]\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction delegate(elements, selector, type, callback, useCapture) {\n // Handle the regular Element usage\n if (typeof elements.addEventListener === 'function') {\n return _delegate.apply(null, arguments);\n }\n\n // Handle Element-less usage, it defaults to global delegation\n if (typeof type === 'function') {\n // Use `document` as the first parameter, then apply arguments\n // This is a short way to .unshift `arguments` without running into deoptimizations\n return _delegate.bind(null, document).apply(null, arguments);\n }\n\n // Handle Selector-based usage\n if (typeof elements === 'string') {\n elements = document.querySelectorAll(elements);\n }\n\n // Handle Array-like based usage\n return Array.prototype.map.call(elements, function (element) {\n return _delegate(element, selector, type, callback, useCapture);\n });\n}\n\n/**\n * Finds closest match and invokes callback.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Function}\n */\nfunction listener(element, selector, type, callback) {\n return function(e) {\n e.delegateTarget = closest(e.target, selector);\n\n if (e.delegateTarget) {\n callback.call(element, e);\n }\n }\n}\n\nmodule.exports = delegate;\n\n\n/***/ }),\n\n/***/ 879:\n/***/ (function(__unused_webpack_module, exports) {\n\n/**\n * Check if argument is a HTML element.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.node = function(value) {\n return value !== undefined\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Check if argument is a list of HTML elements.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.nodeList = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return value !== undefined\n && (type === '[object NodeList]' || type === '[object HTMLCollection]')\n && ('length' in value)\n && (value.length === 0 || exports.node(value[0]));\n};\n\n/**\n * Check if argument is a string.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.string = function(value) {\n return typeof value === 'string'\n || value instanceof String;\n};\n\n/**\n * Check if argument is a function.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.fn = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return type === '[object Function]';\n};\n\n\n/***/ }),\n\n/***/ 370:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar is = __webpack_require__(879);\nvar delegate = __webpack_require__(438);\n\n/**\n * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n if (!target && !type && !callback) {\n throw new Error('Missing required arguments');\n }\n\n if (!is.string(type)) {\n throw new TypeError('Second argument must be a String');\n }\n\n if (!is.fn(callback)) {\n throw new TypeError('Third argument must be a Function');\n }\n\n if (is.node(target)) {\n return listenNode(target, type, callback);\n }\n else if (is.nodeList(target)) {\n return listenNodeList(target, type, callback);\n }\n else if (is.string(target)) {\n return listenSelector(target, type, callback);\n }\n else {\n throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n }\n}\n\n/**\n * Adds an event listener to a HTML element\n * and returns a remove listener function.\n *\n * @param {HTMLElement} node\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNode(node, type, callback) {\n node.addEventListener(type, callback);\n\n return {\n destroy: function() {\n node.removeEventListener(type, callback);\n }\n }\n}\n\n/**\n * Add an event listener to a list of HTML elements\n * and returns a remove listener function.\n *\n * @param {NodeList|HTMLCollection} nodeList\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNodeList(nodeList, type, callback) {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.addEventListener(type, callback);\n });\n\n return {\n destroy: function() {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.removeEventListener(type, callback);\n });\n }\n }\n}\n\n/**\n * Add an event listener to a selector\n * and returns a remove listener function.\n *\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenSelector(selector, type, callback) {\n return delegate(document.body, selector, type, callback);\n}\n\nmodule.exports = listen;\n\n\n/***/ }),\n\n/***/ 817:\n/***/ (function(module) {\n\nfunction select(element) {\n var selectedText;\n\n if (element.nodeName === 'SELECT') {\n element.focus();\n\n selectedText = element.value;\n }\n else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {\n var isReadOnly = element.hasAttribute('readonly');\n\n if (!isReadOnly) {\n element.setAttribute('readonly', '');\n }\n\n element.select();\n element.setSelectionRange(0, element.value.length);\n\n if (!isReadOnly) {\n element.removeAttribute('readonly');\n }\n\n selectedText = element.value;\n }\n else {\n if (element.hasAttribute('contenteditable')) {\n element.focus();\n }\n\n var selection = window.getSelection();\n var range = document.createRange();\n\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n\n selectedText = selection.toString();\n }\n\n return selectedText;\n}\n\nmodule.exports = select;\n\n\n/***/ }),\n\n/***/ 279:\n/***/ (function(module) {\n\nfunction E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\nmodule.exports.TinyEmitter = E;\n\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(__webpack_module_cache__[moduleId]) {\n/******/ \t\t\treturn __webpack_module_cache__[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t!function() {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = function(module) {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\tfunction() { return module['default']; } :\n/******/ \t\t\t\tfunction() { return module; };\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t!function() {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = function(exports, definition) {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t!function() {\n/******/ \t\t__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }\n/******/ \t}();\n/******/ \t\n/************************************************************************/\n/******/ \t// module exports must be returned from runtime so entry inlining is disabled\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(686);\n/******/ })()\n.default;\n});",
"/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n\"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; };\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) });\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: true });\n defineProperty(\n GeneratorFunctionPrototype,\n\"constructor\",\n { value: GeneratorFunction, configurable: true }\n );\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n\"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n defineProperty(this, \"_invoke\", { value: enqueue });\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n\"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(val) {\n var object = Object(val);\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n\"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n",
"function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}",
"/*! js-cookie v3.0.1 | MIT */\n/* eslint-disable no-var */\nfunction assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n target[key] = source[key];\n }\n }\n return target\n}\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\nvar defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n};\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\n\nfunction init (converter, defaultAttributes) {\n function set (key, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n key = encodeURIComponent(key)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n key + '=' + converter.write(value, key) + stringifiedAttributes)\n }\n\n function get (key) {\n if (typeof document === 'undefined' || (arguments.length && !key)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var foundKey = decodeURIComponent(parts[0]);\n jar[foundKey] = converter.read(value, foundKey);\n\n if (key === foundKey) {\n break\n }\n } catch (e) {}\n }\n\n return key ? jar[key] : jar\n }\n\n return Object.create(\n {\n set: set,\n get: get,\n remove: function (key, attributes) {\n set(\n key,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n/* eslint-enable no-var */\n\nexport default api;\n",
"// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n",