;(function () { function findPkgdownGlobalRoot () { const origin = window.location.origin const path = window.location.pathname.replace(/[^/]+$/, '') // Special cases supported by our versioned pkgdown workflow const specials = [/dev\//, /preview\//, /v\d+\.\d+\.\d+\//] for (const special of specials) { if (special.test(path)) { return origin + path.split(special)[0] } } const pkgdownDirs = ['articles', 'news', 'reference'] for (const pkgdownDir of pkgdownDirs) { if (path.includes(pkgdownDir)) { return origin + path.split(`${pkgdownDir}/`)[0] } } return origin + path } function pathDir (url) { return url.replace(/\/[^/]+$/, '/') } function ensureTrailingSlash (url) { return /\/$/.test(url) ? url : url + '/' } function ensureFullPath (url) { return /^\//.test(url) ? window.location.origin + url : url } function findPkgdownLocalRoot () { // get `src` attribute of the current